Dans un premier temps, sauvegarder votre fichier de configuration SSH
cp -a /etc/ssh/sshd_config /etc/ssh/sshd_config.backup
Si vous rencontrez des problèmes, voici la procédure pour revenir en arrière :
rm -rf /etc/ssh/sshd_config
cp -a /etc/ssh/sshd_config.backup /etc/ssh/sshd_config
systemctl restart sshd
nano /etc/ssh/sshd_config
Protocol 2
Port 22
ListenAddress Adresse_IP
SyslogFacility AUTH
LogLevel VERBOSE
LoginGraceTime 30
MaxAuthTries 2
PermitRootLogin no
PubkeyAuthentication yes
PasswordAuthentication yes
PermitEmptyPasswords no
AuthenticationMethods publickey,password
StrictModes yes
X11Forwarding no
AllowTCPForwarding no
PrintMotd yes
HostKey /etc/ssh/ssh_host_ecdsa_key
HostKey /etc/ssh/ssh_host_rsa_key
Ciphers aes256-ctr,aes192-ctr,aes128-ctr
MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com
#AllowUsers utilisateur1 utilisateur2
AllowGroups ssh-users
LoginGraceTimeMaxAuthTriesPermitRootLoginPubkeyAuthenticationPasswordAuthenticationAuthenticationMethodsAllowGroupsAllowGroups ssh-users)groupadd ssh-users
usermod -aG ssh-users votre-utilisateur
Avant toute chose, tester la syntaxe du fichier de configuration
sshd -t
systemctl restart sshd