use pubkey auth for containers

This commit is contained in:
Sonny Bakker 2017-11-07 07:06:34 +01:00
parent 4ba2d0ce38
commit 3db1764a7f
3 changed files with 6 additions and 18 deletions

View file

@ -18,7 +18,7 @@ config_ssh() {
sed -i 's/^#Port .*/Port '"$PORT"'/' $CONTAINER_PATH/etc/ssh/sshd_config
sed -i 's/^#PermitRootLogin .*/PermitRootLogin yes/' $CONTAINER_PATH/etc/ssh/sshd_config
sed -i 's/^#PubkeyAuthentication .*/PubkeyAuthentication yes/' $CONTAINER_PATH/etc/ssh/sshd_config
echo $SSHKEY >> $CONTAINER_PATH/root/.ssh/authorized_keys
cat $SSHKEY >> $CONTAINER_PATH/root/.ssh/authorized_keys
}
dotfiles() {
@ -54,7 +54,7 @@ if [ -n "$HOSTNAME" ] ;then
fi
if [ "$SSH_SERVER" == "y" ] ;then
read -e -p "Enter ssh key for ssh access: " SSHKEY
read -e -p "Enter ssh key for container access: " SSHKEY
config_ssh
fi