#!/bin/bash

# Vérifier si le script est exécuté en tant que root
if [ "$EUID" -ne 0 ]; then
  echo "Veuillez exécuter ce script en tant que root."
  exit 1
fi

# Backup the current sshd_config file
cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak

# Allow root login by modifying the sshd_config file
sed -i 's/^#PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config

# Restart the SSH service to apply changes
systemctl restart sshd

echo "Root login via SSH has been enabled."