Skip to content

Commit

Permalink
[os] add authorized_keys file also for root
Browse files Browse the repository at this point in the history
  • Loading branch information
rroohhh committed Aug 9, 2020
1 parent 8e2d40d commit 490fee7
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions makefiles/in_chroot/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 490fee7

Please sign in to comment.