diff --git a/backend/copy.sh b/backend/copy.sh deleted file mode 100755 index bb6c9f8e5..000000000 --- a/backend/copy.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -# Enter the backend directory, copy over the built EmbassyOS binaries and systemd services, edit the nginx config, then create the .ssh directory - -cp target/aarch64-unknown-linux-gnu/release/embassy-init /mnt/usr/local/bin -cp target/aarch64-unknown-linux-gnu/release/embassyd /mnt/usr/local/bin -cp target/aarch64-unknown-linux-gnu/release/embassy-cli /mnt/usr/local/bin -cp *.service /mnt/etc/systemd/system/ - -echo "application/wasm wasm;" | sudo tee -a "/mnt/etc/nginx/mime.types" - -mkdir -p /mnt/root/.ssh diff --git a/backend/src/init.rs b/backend/src/init.rs index 0cb4b9e67..7c51d497b 100644 --- a/backend/src/init.rs +++ b/backend/src/init.rs @@ -125,7 +125,7 @@ pub async fn init(cfg: &RpcContextConfig, product_key: &str) -> Result<(), Error tracing::info!("Loaded Package Docker Images"); } - crate::ssh::sync_keys_from_db(&secret_store, "/root/.ssh/authorized_keys").await?; + crate::ssh::sync_keys_from_db(&secret_store, "/home/start9/.ssh/authorized_keys").await?; tracing::info!("Synced SSH Keys"); let db = cfg.db(&secret_store, product_key).await?; diff --git a/backend/src/ssh.rs b/backend/src/ssh.rs index 8a23e63de..b4d35033d 100644 --- a/backend/src/ssh.rs +++ b/backend/src/ssh.rs @@ -12,7 +12,7 @@ use crate::util::display_none; use crate::util::serde::{display_serializable, IoFormat}; use crate::{Error, ErrorKind}; -static SSH_AUTHORIZED_KEYS_FILE: &str = "/root/.ssh/authorized_keys"; +static SSH_AUTHORIZED_KEYS_FILE: &str = "/home/start9/.ssh/authorized_keys"; #[derive(Debug, serde::Deserialize, serde::Serialize)] pub struct PubKey( diff --git a/build/write-image.sh b/build/write-image.sh index 9386ab2ad..415d56000 100755 --- a/build/write-image.sh +++ b/build/write-image.sh @@ -76,8 +76,11 @@ sudo cp -R frontend/dist/setup-wizard /tmp/eos-mnt/var/www/html/setup sudo cp -R frontend/dist/ui /tmp/eos-mnt/var/www/html/main sudo cp index.html /tmp/eos-mnt/var/www/html/index.html -# Make the .ssh directory -sudo mkdir -p /tmp/eos-mnt/root/.ssh +# Make the .ssh directory for UID 1000 user +sudo mkdir -p /tmp/eos-mnt/home/$(awk -v val=1000 -F ":" '$3==val{print $1}' /tmp/eos-mnt/etc/passwd)/.ssh +sudo mv /tmp/eos-mnt/etc/sudoers.d/010_pi-nopasswd /tmp/eos-mnt/etc/sudoers.d/010_start9-nopasswd +sudo sed -i 's/pi/start9/g' /tmp/eos-mnt/etc/sudoers.d/010_start9-nopasswd +sudo sed -i 's/ pi / start9 /g' /tmp/eos-mnt/etc/systemd/system/autologin@.service # Custom MOTD sudo rm /tmp/eos-mnt/etc/motd