ncp.sh,SSH.sh: Move root login configuration to SSH.sh

Signed-off-by: Tobias K <6317548+theCalcaholic@users.noreply.github.com>
This commit is contained in:
Tobias K 2024-05-02 02:48:28 +02:00
parent ab4545399e
commit 96b2c19823
No known key found for this signature in database
GPG Key ID: 44FD368932E645C1
3 changed files with 14 additions and 2 deletions

View File

@ -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()

1
ncp.sh
View File

@ -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

View File

@ -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."