fixup permissions when installing keys

This commit is contained in:
Jörg Thalheim 2022-11-10 17:09:44 +01:00
parent f83ec524bb
commit a6b13228b5

View file

@ -79,9 +79,10 @@
# Restore ssh host and user keys if they are available.
# This avoids warnings of unknown ssh keys.
boot.initrd.postMountCommands = ''
mkdir -p /mnt-root/etc/ssh /mnt-root/root/.ssh
mkdir -m 700 -p /mnt-root/root/.ssh
mkdir -m 755 -p /mnt-root/etc/ssh
if [[ -f /ssh/authorized_keys ]]; then
cp ssh/authorized_keys /mnt-root/root/.ssh/
install -m 400 ssh/authorized_keys /mnt-root/root/.ssh
fi
install -m 400 ssh/ssh_host_* /mnt-root/etc/ssh
'';