Create a key (client):
ssh-keygen -t ed25519 -C "me@host"
Install public key:
ssh-copy-id user@server
Edit /etc/ssh/sshd_config (or a file in /etc/ssh/sshd_config.d/):
PermitRootLogin noPasswordAuthentication no (if keys are set up)PubkeyAuthentication yesAllowUsers alice bob (or AllowGroups ssh-users)MaxAuthTries 3LoginGraceTime 30Validate + reload:
sudo sshd -t
sudo systemctl reload ssh
Fail2Ban example (conceptual):