Code-Memo

SSH hardening

Key goals

Use key-based auth

Create a key (client):

ssh-keygen -t ed25519 -C "me@host"

Install public key:

ssh-copy-id user@server

Harden sshd_config (common settings)

Edit /etc/ssh/sshd_config (or a file in /etc/ssh/sshd_config.d/):

Validate + reload:

sudo sshd -t
sudo systemctl reload ssh

Reduce exposure

Brute-force protection

Fail2Ban example (conceptual):