Update debian.sh

This commit is contained in:
Xiufeng Guo 2024-07-04 21:57:19 +09:00
parent f8a99c1bbf
commit 9e918e964b
Signed by: showfom
GPG Key ID: 29A7777777777777

View File

@ -178,14 +178,6 @@ function disable_ssh_password() {
echo '### Disable SSH password ###'
printf "\E[0m"
# codename=$(lsb_release -sc)
#
# if [ "$codename" == "buster" ]; then
# cp -r /etc/ssh/sshd_config /etc/ssh/sshd_config.$(date +"%Y_%m_%d_%I_%M_%p").bak
# sed -i -E 's/#?PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config
# sed -i -E 's/#?PermitRootLogin.*/PermitRootLogin without-password/' /etc/ssh/sshd_config
# echo 'DebianBanner no' >> /etc/ssh/sshd_config
# else
cat > /etc/ssh/sshd_config.d/disable_password.conf << EOF
PermitRootLogin prohibit-password
PasswordAuthentication no
@ -197,7 +189,6 @@ EOF
HostKeyAlgorithms +ssh-rsa
PubkeyAcceptedKeyTypes +ssh-rsa
EOF
fi
printf "\E[0;33;40m"
echo "### SSH password disabled ###"