diff --git a/setup_server.sh b/setup_server.sh index 2bd4648..b879ed0 100644 --- a/setup_server.sh +++ b/setup_server.sh @@ -50,9 +50,12 @@ echo "y" | sudo ufw enable # Změna SSH konfigurace sudo sed -i "s/#Port 22/Port $SSH_PORT/" /etc/ssh/sshd_config -sudo sed -i 's/PermitRootLogin yes/PermitRootLogin no/' /etc/ssh/sshd_config +sudo sed -i 's/#PermitRootLogin.*/PermitRootLogin no/' /etc/ssh/sshd_config +sudo sed -i 's/PermitRootLogin .*/PermitRootLogin no/' /etc/ssh/sshd_config sudo sed -i 's/#PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config +sudo sed -i 's/PasswordAuthentication .*/PasswordAuthentication no/' /etc/ssh/sshd_config sudo sed -i 's/#PubkeyAuthentication yes/PubkeyAuthentication yes/' /etc/ssh/sshd_config +sudo sed -i 's/PubkeyAuthentication .*/PubkeyAuthentication yes/' /etc/ssh/sshd_config # Restart SSH služby, aby se změny projevily if systemctl list-units --type=service | grep -q "ssh.service"; then