Knowledge base / Linux & server administration
Knowledge base / Linux & server administration
Every internet-facing server gets thousands of SSH login attempts a day. These settings make them harmless.
PermitRootLogin prohibit-password # or "no" if you use sudo users PasswordAuthentication no KbdInteractiveAuthentication no PubkeyAuthentication yes MaxAuthTries 3 AllowUsers alice bob rakar
Make sure your key login works in a second session before you reload: sshd -t && systemctl reload sshd. Keep the first session open until you've tested.
ssh-keygen -t ed25519.~/.ssh/authorized_keys on every server regularly.