Skip to content

Commit

Permalink
ncp.sh,SSH.sh: Move root login configuration to SSH.sh
Browse files Browse the repository at this point in the history
Signed-off-by: Tobias K <[email protected]>
  • Loading branch information
theCalcaholic committed May 2, 2024
1 parent ab45453 commit 96b2c19
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
7 changes: 7 additions & 0 deletions bin/ncp/NETWORKING/SSH.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@
install() {
apt-get update
apt-get install -y --no-install-recommends openssh-server
if grep '^PermitRootLogin' /etc/ssh/sshd_config
then
sed -i -e 's/^PermitRootLogin.*$/PermitRootLogin prohibit-password/' /etc/ssh/sshd_config
else
echo 'PermitRootLogin prohibit-password' >> /etc/ssh/sshd_config
fi
systemctl reload ssh
}

is_active()
Expand Down
1 change: 0 additions & 1 deletion ncp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ EOF
is_docker || is_lxc || {
chsh -s /usr/sbin/nologin "$WEBADMIN"
passwd -l root
sed -i -e 's/^PermitRootLogin.*$/PermitRootLogin No/' /etc/ssh/sshd_config
}

## NCP LAUNCHER
Expand Down
8 changes: 7 additions & 1 deletion updates/1.54.0.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@ if getent passwd "root" | grep -e '/usr/sbin/nologin'
then
chsh -s /bin/bash root
passwd -l root
sed -i -e 's/^PermitRootLogin.*$/PermitRootLogin No/' /etc/ssh/sshd_config
if grep '^PermitRootLogin' /etc/ssh/sshd_config
then
sed -i -e 's/^PermitRootLogin.*$/PermitRootLogin prohibit-password/' /etc/ssh/sshd_config
else
echo 'PermitRootLogin prohibit-password' >> /etc/ssh/sshd_config
fi
systemctl reload ssh
fi
echo "done."

Expand Down

0 comments on commit 96b2c19

Please sign in to comment.