From aaeedbe60cec765b88e087c9774f22c7f5cadad0 Mon Sep 17 00:00:00 2001 From: Sonny Date: Sat, 17 Jun 2017 21:18:47 +0200 Subject: [PATCH] Restart ssh server --- scripts/create_container | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/create_container b/scripts/create_container index 40090a0..40f523a 100755 --- a/scripts/create_container +++ b/scripts/create_container @@ -38,13 +38,15 @@ function create_container { } function add_ssh { + CONTAINER_PATH=$1 echo -n "Enter ssh listening port: " read PORT echo "Editing ssh config" - # edit ssh config - sed -i 's/^#Port .*/Port '"$PORT"'/' $1/etc/ssh/sshd_config - sed -i 's/^#PermitRootLogin .*/PermitRootLogin yes/' $1/etc/ssh/sshd_config + sed -i 's/^#Port .*/Port '"$PORT"'/' $CONTAINER_PATH/etc/ssh/sshd_config + sed -i 's/^#PermitRootLogin .*/PermitRootLogin yes/' $CONTAINER_PATH/etc/ssh/sshd_config + # Restart ssh in order to load changes + systemd-nspawn -D $CONTAINER_PATH systemctl restart ssh } function dotfiles {