| Use SSH keys for authentication |
Generate per user keys, store private keys securely, and deploy public keys to authorized keys. |
Keys are resistant to online guessing and can be rotated per user. |
Reduces credential stuffing and brute force effectiveness. |
| Disable password authentication where feasible |
Set PasswordAuthentication to no and ensure all users have working keys first. |
Passwords are easy to brute force and easy to phish. |
Eliminates password based brute force as an entry path. |
| Disable direct root login |
Set PermitRootLogin to no or at least prohibit password based root login and use sudo for elevation. |
Root is a high value target and often brute forced. |
Reduces direct privilege takeover risk. |
| Restrict who can log in |
Use AllowUsers or AllowGroups to define explicit allowed identities. |
A smaller allowed set reduces exposure and simplifies monitoring. |
Limits access and reduces account abuse risk. |
| Limit network exposure |
Bind SSH to management interfaces, use firewall rules, and prefer VPN or a bastion host for internet access. |
If fewer networks can reach SSH, fewer attackers can test credentials. |
Large reduction in attack surface. |
| Enable rate limiting and abuse controls |
Use tools such as fail2ban or firewall rate limits to slow repeated failures. |
Attackers rely on high volume guessing. |
Reduces brute force throughput and noise. |
| Use modern crypto defaults |
Keep OpenSSH updated and avoid enabling legacy ciphers or weak key types for compatibility unless required. |
Legacy crypto options are weaker and increase risk. |
Improves confidentiality and integrity of sessions. |
| Log and monitor SSH activity |
Collect auth logs and alert on repeated failures, new source locations, and admin logons. |
SSH attacks are visible if you look at the right signals. |
Improves detection and investigation quality. |
| Use separate admin accounts |
Do not use personal accounts for privileged tasks. Use sudo with auditability. |
It reduces accidental privilege creep and improves accountability. |
Better traceability and reduced blast radius. |