Why SSH is attacked so much
SSH gives full shell access, often with sudo. Automated scanners sweep the internet for port 22 and try lists of usernames such as root, admin and ubuntu with common passwords. A single weak password is enough. Even when attacks fail, they fill logs and waste resources. Attackers also look for keys accidentally published in code repositories, backups left in web roots and old accounts that nobody remembered to remove. The good news is that SSH, configured properly and managed with simple habits, is extremely hard to break, and most of the work is a one-time setup measured in minutes rather than days.

Use SSH keys, not passwords
An SSH key pair has a private key that stays on your computer and a public key you place on the server. Logging in proves you hold the private key without sending a password. Modern Ed25519 keys are short, fast and secure.
# On your computer
ssh-keygen -t ed25519 -C "yourname@company"
ssh-copy-id yourname@your.server.ip
Protect the private key with a passphrase, and use an SSH agent so you only type it occasionally. For the strongest protection, store keys on a hardware security key, which never lets the private key leave the device. Keep a second admin key in a safe place as a backup, so losing a laptop does not mean losing access.
SSH security best practices in sshd_config
These lines in /etc/ssh/sshd_config (or a file in sshd_config.d/) cover most of the hardening. The OpenSSH manual documents every option.
| Setting | Recommended value | Why |
|---|---|---|
PasswordAuthentication | no | Stops password guessing entirely |
KbdInteractiveAuthentication | no (unless using 2FA) | Closes another password path |
PermitRootLogin | no | Attackers must also guess a username; use sudo |
AllowUsers / AllowGroups | Named admins only | Service accounts cannot log in |
MaxAuthTries | 3 | Limits attempts per connection |
LoginGraceTime | 30 | Drops idle unauthenticated connections |
X11Forwarding | no | Disables a rarely needed feature |
AllowAgentForwarding | no unless needed | Reduces risk if the server is compromised |
After editing, check the configuration with sudo sshd -t, reload SSH, and test a new login in a second terminal before closing your existing session.
Restrict where SSH can be reached from
- Firewall by IP: allow SSH only from your office or admin IPs. See firewall best practices.
- VPN first: put SSH on a private address reachable only through WireGuard or OpenVPN.
- Bastion host: in larger setups, admins connect to one hardened jump server, which then reaches the others.
Changing the SSH port reduces log noise from bots but is not security on its own; treat it as a convenience.
Brute-force protection
Even with keys only, bots keep trying. Fail2ban reads SSH logs and temporarily blocks IPs after repeated failures. Firewall rate limits on new SSH connections add another layer. Together they cut noise and resource use.
Two-factor authentication
For higher-risk servers, require a second factor in addition to the key, such as a time-based one-time code via a PAM module or hardware security keys supported by modern OpenSSH. Test carefully and keep console access available, because misconfigured 2FA is a common way to lock yourself out.
Key management for teams
- One key per person per device; never share private keys.
- Each person logs in as their own user; no shared accounts.
- Keep a list of which public keys belong to whom.
- Remove keys immediately when someone leaves or loses a device.
- Review
authorized_keysfiles every few months. - For larger teams, consider SSH certificates with short validity, which expire automatically.
Secure file transfer and deployments
SSH is not only for interactive logins. SFTP and rsync over SSH move files, and deployment tools connect over SSH to update applications. Apply the same discipline to these uses. Give deployment pipelines their own dedicated user with only the permissions needed to update the application directory, and use a separate key that lives in your CI system's secret store rather than on a developer's laptop. For clients or staff who only need to upload files, consider SFTP-only accounts restricted to their own directory (a "chroot"), so they cannot open a shell at all. Retire legacy FTP entirely; it sends passwords in plain text.
SSH on Windows Server
Modern Windows Server versions include an OpenSSH server as an optional feature. If you use it, the same principles apply: keys rather than passwords, restricted users, firewall rules and logging. Most Windows administration still happens over Remote Desktop, which should sit behind a VPN or gateway rather than being exposed to the internet.
Keep OpenSSH updated
Like any software, OpenSSH occasionally has security fixes. Automatic security updates from your distribution keep it current; check after major OS upgrades that your configuration is still in place, as package updates sometimes add new default files. Root access gives you full control here, as explained in server root access explained.
Monitor SSH activity
- Alert on successful logins from unexpected IPs or at unusual times.
- Alert on new users or new keys added to
authorized_keys. - Keep authentication logs on a separate system.
- Review sudo usage periodically.
SSH hardening checklist
- Every admin has a personal Ed25519 key with a passphrase.
- Each admin logs in as a named user; root login is disabled.
- Password and keyboard-interactive authentication are off (unless used for 2FA).
AllowUsersorAllowGroupslists only current admins.- SSH is reachable only from admin IPs or through a VPN.
- Fail2ban and firewall rate limits are active.
- Deployment and SFTP users are restricted to what they need.
- Authentication logs are shipped off the server and reviewed.
- Out-of-band console access is tested and its credentials stored safely.
- Keys are reviewed every quarter and removed on departures.
A hypothetical lockout, avoided
An admin disables password login and restarts SSH, then realises their key was never copied for the new user. Because they followed the rule of keeping the old session open, they simply add the key from that session and test again. On another server without that habit, the same mistake would mean logging in through the iLO console to fix it, which is exactly why out-of-band access belongs in every server plan.
SSH mistakes to avoid
- Disabling passwords before confirming key login works.
- Sharing one private key among the whole team.
- Leaving old employees' keys on servers.
- Storing private keys unencrypted on shared machines.
- Exposing SSH to the whole internet when a VPN is available.
- Forgetting that some installers re-enable password login.
For the full first-day routine, see how to secure a dedicated server; for broader hardening, see the server hardening guide.
Why businesses choose SkyRain Cloud dedicated servers
SkyRain Cloud dedicated servers make strict SSH policies safe to apply:
- Indian data centers, Indian latency. Intel Xeon dedicated servers are hosted in Mumbai and Delhi, close to customers across India.
- The whole machine is yours. 100% unshared hardware: no other tenants competing for CPU, memory or disk.
- DDoS protection included on the network, so a flood aimed at your IP does not have to become your problem alone.
- Full control. Root or Administrator access plus iLO/IPMI out-of-band management to reboot, reinstall or mount your own ISO.
- Real support channels. 24/7 support tickets, WhatsApp and a Discord community, plus a public status page.
- Simple billing. Monthly billing in rupees with UPI, net banking and cards.
Frequently Asked Questions
Should I disable SSH password authentication?
Which SSH key type should I use?
Is changing the SSH port worth it?
How do I revoke SSH access when someone leaves?
What if I lock myself out of SSH?
Do I need Fail2ban if I use SSH keys?
Conclusion
SSH security best practices are straightforward: keys instead of passwords, no root login, named users only, restricted access, brute-force protection, careful key management and monitoring. Apply them with a second session open and console access ready, and SSH stops being your weakest point.
Get a server with iLO as your safety net in the plans below, or read more on our dedicated server page.
SkyRain Cloud Dedicated Server Plans
Unshared Intel Xeon bare-metal servers in Mumbai and Delhi data centers with 1 Gbps connectivity. Every plan includes iLO / IPMI out-of-band management, DDoS protection, Full root / Administrator access, Additional IPv4 addresses available and Billed monthly.
| Plan | Cores / Threads | RAM | Storage | Network | Price | Good for | Buy |
|---|---|---|---|---|---|---|---|
| Business 2× Intel Xeon E5-2699 v4 (Mumbai / Delhi) | 44 / 88 (2.2 GHz base, 3.6 GHz turbo) | 128 GB DDR4 ECC | 1 TB NVMe SSD | 1 Gbps | ₹17,999/month | Business websites, stores, databases, ERP and many client sites | Order |
| Enterprise 2× Intel Xeon Platinum 8269CY (Mumbai / Delhi) | 52 / 104 (2.5 GHz base, 3.8 GHz turbo) | 128 GB DDR4 ECC | 1 TB NVMe SSD | 1 Gbps | ₹19,999/month | Virtualization hosts, large databases, SaaS and container platforms | Order |
| Custom | More RAM or storage, a second server for failover, or several servers for a cluster: quoted by the team. | Clusters, failover pairs, unusual specs | Ask | ||||
Prices are monthly in INR as listed on the SkyRain Cloud store (verified 2026-11-23). Live stock and final price are shown at checkout.