diff --git a/makefiles/in_chroot/install.sh b/makefiles/in_chroot/install.sh index 26c7cbcd..46405274 100755 --- a/makefiles/in_chroot/install.sh +++ b/makefiles/in_chroot/install.sh @@ -34,12 +34,17 @@ if ! [ -d /home/$USERNAME ]; then fi # add empty ~/.ssh/authorized_keys (see #80) -SSH_AUTHORIZED_KEYS=/home/$USERNAME/.ssh/authorized_keys -mkdir -p -m 700 $(dirname $SSH_AUTHORIZED_KEYS) -chown $USERNAME:users $(dirname $SSH_AUTHORIZED_KEYS) -touch $SSH_AUTHORIZED_KEYS -chown $USERNAME:users $SSH_AUTHORIZED_KEYS -chmod 600 $SSH_AUTHORIZED_KEYS +function add_authorized_keys_file() { + SSH_AUTHORIZED_KEYS=/home/$1/.ssh/authorized_keys + mkdir -p -m 700 $(dirname $SSH_AUTHORIZED_KEYS) + chown $1:users $(dirname $SSH_AUTHORIZED_KEYS) + touch $SSH_AUTHORIZED_KEYS + chown $1:users $SSH_AUTHORIZED_KEYS + chmod 600 $SSH_AUTHORIZED_KEYS +} + +add_authorized_keys_file $USERNAME +add_authorized_keys_file "root" # remove default arch linux arm user userdel -r -f alarm || true