SSH
Permissions
Authorize root login
Open sshd_config
sudo nano /etc/ssh/sshd_config
Modify these lines
# Authentication: #LoginGraceTime 2m PermitRootLogin yes #StrictModes yes #MaxAuthTries 6 #MaxSessions 10
Restart the server
sudo systemctl restart sshd
Clés SSH
Générer clé
ssh-keygen
Copier clé sur serveur distant
ssh-copy-id [user]@[ip]
Tester connexion sans mot de passe
ssh [user]@[ip]
Specify a ssh key
ssh -i <key> <user>@<ip>
Log SSH
See all logs
sudo grep 'sshd' /var/log/auth.log
Show login attempts
sudo lastb -F
Show failed password attempts
sudo grep 'Failed password' /var/log/auth.log
Show success password attempts
sudo grep 'Accepted password' /var/log/auth.log