Restart ssh server

This commit is contained in:
Sonny 2017-06-17 21:18:47 +02:00
parent 06e8f1e385
commit aaeedbe60c

View file

@ -38,13 +38,15 @@ function create_container {
} }
function add_ssh { function add_ssh {
CONTAINER_PATH=$1
echo -n "Enter ssh listening port: " echo -n "Enter ssh listening port: "
read PORT read PORT
echo "Editing ssh config" echo "Editing ssh config"
# edit ssh config sed -i 's/^#Port .*/Port '"$PORT"'/' $CONTAINER_PATH/etc/ssh/sshd_config
sed -i 's/^#Port .*/Port '"$PORT"'/' $1/etc/ssh/sshd_config sed -i 's/^#PermitRootLogin .*/PermitRootLogin yes/' $CONTAINER_PATH/etc/ssh/sshd_config
sed -i 's/^#PermitRootLogin .*/PermitRootLogin yes/' $1/etc/ssh/sshd_config # Restart ssh in order to load changes
systemd-nspawn -D $CONTAINER_PATH systemctl restart ssh
} }
function dotfiles { function dotfiles {