Chroot: include openssh-server and add keys

This commit is contained in:
Jeremy Gardais 2019-04-03 17:03:48 +02:00
parent 28428ffb18
commit de35719b12
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 11 additions and 2 deletions

13
debian/chroot.install vendored
View File

@ -30,7 +30,7 @@ RESET='\033[0m'
## Package to exclude from debootstrap install
dbs_pkg_exclude="vim"
## Package to include to debootstrap install
dbs_pkg_include="aptitude,bzip2,debconf-i18n,dialog,dmsetup,htop,isc-dhcp-client,isc-dhcp-common,locales,lvm2,pciutils,tmux,vim-nox,wget,zsh"
dbs_pkg_include="aptitude,bzip2,debconf-i18n,dialog,dmsetup,htop,isc-dhcp-client,isc-dhcp-common,locales,lvm2,openssh-server,pciutils,tmux,vim-nox,wget,zsh"
# Partitionning {{{
if [ "${manage_part}" -eq 0 ]; then
@ -201,7 +201,16 @@ sed -i 's;/target;;g' /target/etc/fstab
## }}}
# }}}
# Finish {{{
## SSH {{{
### Allow root connections - this should be fixed if it works
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
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}"
fi
## }}}
printf '%b\\n' "${REDB}Please change the root's password:${RESET}"
chroot /target passwd