From 5dafd636b6afef22a21571bd0af6d334ddb88ed8 Mon Sep 17 00:00:00 2001 From: Florin Grad Date: Wed, 19 Sep 2001 12:18:16 +0000 Subject: RootSshLogin --- init-sh/level0.sh | 1 + init-sh/level1.sh | 1 + init-sh/level2.sh | 1 + init-sh/level3.sh | 1 + init-sh/level4.sh | 7 +------ init-sh/level5.sh | 17 +---------------- init-sh/lib.sh | 13 +++++++++++++ init-sh/lib.sh.usermode | 14 ++++++++++++++ 8 files changed, 33 insertions(+), 22 deletions(-) (limited to 'init-sh') diff --git a/init-sh/level0.sh b/init-sh/level0.sh index 8d09aff..3cb6b22 100755 --- a/init-sh/level0.sh +++ b/init-sh/level0.sh @@ -89,3 +89,4 @@ AllowAutologin # Boot on a shell / authorize ctrl-alt-del AllowReboot AllowUserList +RootSshLogin 0 diff --git a/init-sh/level1.sh b/init-sh/level1.sh index 99ce8a3..57db69a 100755 --- a/init-sh/level1.sh +++ b/init-sh/level1.sh @@ -90,3 +90,4 @@ AllowAutologin # Do not boot on a shell AllowReboot AllowUserList +RootSshLogin 1 diff --git a/init-sh/level2.sh b/init-sh/level2.sh index b2fd33f..d0facdb 100755 --- a/init-sh/level2.sh +++ b/init-sh/level2.sh @@ -91,3 +91,4 @@ AllowAutologin # Do not boot on a shell AllowReboot AllowUserList +RootSshLogin 2 diff --git a/init-sh/level3.sh b/init-sh/level3.sh index 6d41afc..34ed29a 100755 --- a/init-sh/level3.sh +++ b/init-sh/level3.sh @@ -92,3 +92,4 @@ ForbidAutologin grpconv AllowUserList +RootSshLogin 3 diff --git a/init-sh/level4.sh b/init-sh/level4.sh index 62aa2d6..70f8070 100755 --- a/init-sh/level4.sh +++ b/init-sh/level4.sh @@ -127,10 +127,5 @@ ForbidAutologin # Group were modified in lib.sh... grpconv - - - - - - ForbidUserList +RootSshLogin 4 diff --git a/init-sh/level5.sh b/init-sh/level5.sh index c894b44..77f35ec 100755 --- a/init-sh/level5.sh +++ b/init-sh/level5.sh @@ -148,20 +148,5 @@ echo # Group were modified in lib.sh... grpconv - - - - - - - - - - - - - - - - ForbidUserList +RootSshLogin 5 diff --git a/init-sh/lib.sh b/init-sh/lib.sh index 9fb580f..baf2b4f 100644 --- a/init-sh/lib.sh +++ b/init-sh/lib.sh @@ -297,6 +297,19 @@ AllowReboot() { echo "done." } +RootSshLogin () { + echo -n "Setting up the root ssh login : " + if [[ $1 == 4 || $1 == 5 ]]; then + /bin/sed 's/PermitRootLogin yes/PermitRootLogin no/' < /etc/ssh/sshd_config > /etc/ssh/sshd_config.new + mv /etc/ssh/sshd_config.new /etc/ssh/sshd_config + chmod 0600 /etc/ssh/sshd_config + else + sed 's/PermitRootLogin no/PermitRootLogin yes/' < /etc/ssh/sshd_config > /etc/ssh/sshd_config.new + mv /etc/ssh/sshd_config.new /etc/ssh/sshd_config + chmod 0600 /etc/ssh/sshd_config + fi +} + # If we are currently installing our # system with DrakX, we don't ask anything to the user... # Instead, DrakX do it and give us a file with some variable. diff --git a/init-sh/lib.sh.usermode b/init-sh/lib.sh.usermode index 6f1f65e..cb39b61 100644 --- a/init-sh/lib.sh.usermode +++ b/init-sh/lib.sh.usermode @@ -287,6 +287,20 @@ AllowReboot() { echo "done." } +RootSshLogin () { + echo -n "Setting up the root ssh login : " + if [[ $1 == 4 || $1 == 5 ]]; then + /bin/sed 's/PermitRootLogin yes/PermitRootLogin no/' < /etc/ssh/sshd_config > /etc/ssh/sshd_config.new + mv /etc/ssh/sshd_config.new /etc/ssh/sshd_config + chmod 0600 /etc/ssh/sshd_config + else + sed 's/PermitRootLogin no/PermitRootLogin yes/' < /etc/ssh/sshd_config > /etc/ssh/sshd_config.new + mv /etc/ssh/sshd_config.new /etc/ssh/sshd_config + chmod 0600 /etc/ssh/sshd_config + fi +} + + # If we are currently installing our # system with DrakX, we don't ask anything to the user... # Instead, DrakX do it and give us a file with some variable. -- cgit v1.2.1