From 490fee72438ded01e4438d772db72c8f642de973 Mon Sep 17 00:00:00 2001 From: Robin Ole Heinemann Date: Sun, 9 Aug 2020 22:02:21 +0200 Subject: [PATCH] [os] add authorized_keys file also for root --- makefiles/in_chroot/install.sh | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) 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