Skip to content

Commit 96b2c19

Browse files
committed
ncp.sh,SSH.sh: Move root login configuration to SSH.sh
Signed-off-by: Tobias K <[email protected]>
1 parent ab45453 commit 96b2c19

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

bin/ncp/NETWORKING/SSH.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@
1111
install() {
1212
apt-get update
1313
apt-get install -y --no-install-recommends openssh-server
14+
if grep '^PermitRootLogin' /etc/ssh/sshd_config
15+
then
16+
sed -i -e 's/^PermitRootLogin.*$/PermitRootLogin prohibit-password/' /etc/ssh/sshd_config
17+
else
18+
echo 'PermitRootLogin prohibit-password' >> /etc/ssh/sshd_config
19+
fi
20+
systemctl reload ssh
1421
}
1522

1623
is_active()

ncp.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ EOF
8383
is_docker || is_lxc || {
8484
chsh -s /usr/sbin/nologin "$WEBADMIN"
8585
passwd -l root
86-
sed -i -e 's/^PermitRootLogin.*$/PermitRootLogin No/' /etc/ssh/sshd_config
8786
}
8887

8988
## NCP LAUNCHER

updates/1.54.0.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,13 @@ if getent passwd "root" | grep -e '/usr/sbin/nologin'
77
then
88
chsh -s /bin/bash root
99
passwd -l root
10-
sed -i -e 's/^PermitRootLogin.*$/PermitRootLogin No/' /etc/ssh/sshd_config
10+
if grep '^PermitRootLogin' /etc/ssh/sshd_config
11+
then
12+
sed -i -e 's/^PermitRootLogin.*$/PermitRootLogin prohibit-password/' /etc/ssh/sshd_config
13+
else
14+
echo 'PermitRootLogin prohibit-password' >> /etc/ssh/sshd_config
15+
fi
16+
systemctl reload ssh
1117
fi
1218
echo "done."
1319

0 commit comments

Comments
 (0)