From a37a5adae33d16c08b36ac6fddad639a87c5cbde Mon Sep 17 00:00:00 2001 From: Philippe Favre Date: Wed, 2 Apr 2025 17:41:39 +0200 Subject: [PATCH] Actualiser miscellaneous/secure_ssh.sh --- miscellaneous/secure_ssh.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/miscellaneous/secure_ssh.sh b/miscellaneous/secure_ssh.sh index 2f4cce3..77a15a4 100644 --- a/miscellaneous/secure_ssh.sh +++ b/miscellaneous/secure_ssh.sh @@ -145,7 +145,7 @@ PasswordAuthentication no HostKey /etc/ssh/ssh_host_ed25519_key HostKey /etc/ssh/ssh_host_rsa_key -# Restrict root access +# Restrict root access (root will not be able to connect) PermitRootLogin no # Strict login policy @@ -190,6 +190,17 @@ detect_service() { # Main process main() { + # Warning message before proceeding with the script. + echo "Warning: Before running this script, make sure you have created a user and an SSH key in the authorized_keys file." + echo "The root user will not be able to connect." + + read -p "Do you want to continue? (yes/no): " CONTINUE + + if [[ ! "$CONTINUE" =~ ^([yY]es|[oO]ui)$ ]]; then + echo "Exiting script." + exit 0 + fi + # Detect the SSH service detect_service