Chroot: Just create /root/.ssh dir to copy keys

This commit is contained in:
Jeremy Gardais 2019-04-05 17:43:42 +02:00
parent 85275feeea
commit a5cd62bf0a
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 1 additions and 1 deletions

View File

@ -276,7 +276,7 @@ chroot /target /bin/sh /tmp/latecommand/post.stretch.sh
sed -i 's/\(^\|^\#\)\(PermitRootLogin\).*/\2 yes/g' /target/etc/ssh/sshd_config
### Add current authorized_keys from the rescue system if present
if [ -f /root/.ssh/authorized_keys ]; then
mkdir -p -- /target/root/.ssh/authorized_keys
mkdir -p -- /target/root/.ssh
cp -- /root/.ssh/authorized_keys /target/root/.ssh/authorized_keys
else
printf '%b\n' "${REDB}You might want to define an authorized key for SSH/root in /target/etc/ssh/sshd_config${RESET}"