Actualiser miscellaneous/secure_ssh.sh

This commit is contained in:
2025-04-02 17:41:39 +02:00
parent 25abcbb9e4
commit a37a5adae3

View File

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