Skip to content

Commit

Permalink
Switching SSH keys to start9 user (#1321)
Browse files Browse the repository at this point in the history
* Update ssh.rs for start9 user

* .ssh directory for uid 1000 user

* Update init.rs for start9 user

* “His name is Robert Paulson”

* typo

* just cleaning up ...
  • Loading branch information
k0gen authored May 9, 2022
1 parent 864555b commit 10d7a3d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 16 deletions.
12 changes: 0 additions & 12 deletions backend/copy.sh

This file was deleted.

2 changes: 1 addition & 1 deletion backend/src/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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?;

Expand Down
2 changes: 1 addition & 1 deletion backend/src/ssh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
7 changes: 5 additions & 2 deletions build/write-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 10d7a3d

Please sign in to comment.