Sécuriser un VPS
SSH, firewall, mises à jour et bonnes pratiques.
Mises à jour
apt update -y
apt upgrade -y
Créer un utilisateur + sudo
adduser craftpick
usermod -aG sudo craftpick
SSH (recommandé)
mkdir -p ~/.ssh
chmod 700 ~/.ssh
nano ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
Firewall
apt install -y ufw
ufw allow OpenSSH
ufw enable
Durcir SSH
nano /etc/ssh/sshd_config
PasswordAuthentication no
PermitRootLogin no
systemctl restart ssh
Fail2ban
apt install -y fail2ban
systemctl enable --now fail2ban
Vérifier l’état
ufw status verbose
fail2ban-client status