Security & Backups9 min read•Last updated: •By SkyRain Cloud Team

SSH Security Best Practices for Dedicated Server Owners

Check the authentication log on any public Linux server and you will see thousands of failed SSH login attempts a day from bots trying common usernames and passwords. SSH is the front door to your server, which makes it the most attacked service you run. Following SSH security best practices turns that door from a target into a dead end for automated attacks.

The short answer: use key-based authentication, disable password and root login, restrict who can log in and from where, add brute-force protection, keep OpenSSH updated and manage keys carefully as your team changes. This guide walks through each practice, with configuration examples and the mistakes that lock people out.

Quick answer

SSH security best practices for a dedicated server: use SSH keys (Ed25519) instead of passwords, set PasswordAuthentication no and PermitRootLogin no, allow only named users or groups, restrict SSH by IP or put it behind a VPN, limit authentication attempts, run Fail2ban, keep OpenSSH patched, consider two-factor authentication, and manage keys per person with prompt revocation. Always test a new login before closing your current session.

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.

SSH security best practices – SkyRain Cloud bare metal servers in India

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.

SettingRecommended valueWhy
PasswordAuthenticationnoStops password guessing entirely
KbdInteractiveAuthenticationno (unless using 2FA)Closes another password path
PermitRootLoginnoAttackers must also guess a username; use sudo
AllowUsers / AllowGroupsNamed admins onlyService accounts cannot log in
MaxAuthTries3Limits attempts per connection
LoginGraceTime30Drops idle unauthenticated connections
X11ForwardingnoDisables a rarely needed feature
AllowAgentForwardingno unless neededReduces 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

  1. One key per person per device; never share private keys.
  2. Each person logs in as their own user; no shared accounts.
  3. Keep a list of which public keys belong to whom.
  4. Remove keys immediately when someone leaves or loses a device.
  5. Review authorized_keys files every few months.
  6. 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

  1. Every admin has a personal Ed25519 key with a passphrase.
  2. Each admin logs in as a named user; root login is disabled.
  3. Password and keyboard-interactive authentication are off (unless used for 2FA).
  4. AllowUsers or AllowGroups lists only current admins.
  5. SSH is reachable only from admin IPs or through a VPN.
  6. Fail2ban and firewall rate limits are active.
  7. Deployment and SFTP users are restricted to what they need.
  8. Authentication logs are shipped off the server and reviewed.
  9. Out-of-band console access is tested and its credentials stored safely.
  10. 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?
Yes. Once key-based login works for every admin, set PasswordAuthentication to no. It removes password guessing as an attack path.
Which SSH key type should I use?
Ed25519 is the recommended modern choice. It is secure, fast and produces short keys. RSA with at least 3072 bits is an alternative for older systems.
Is changing the SSH port worth it?
It reduces automated noise in logs but does not stop a targeted attacker. Use it only alongside keys, no root login and IP or VPN restrictions.
How do I revoke SSH access when someone leaves?
Remove their public key from authorized_keys, disable or delete their user account, and review sudo group membership. SSH certificates with short validity make this easier at scale.
What if I lock myself out of SSH?
Use IPMI, iLO or KVM console access to log in locally and fix the configuration. SkyRain Cloud dedicated servers include iLO for this.
Do I need Fail2ban if I use SSH keys?
It is still useful. Keys stop the attacks succeeding, while Fail2ban reduces log noise and resource use by blocking persistent attackers.

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.

PlanCores / ThreadsRAMStorageNetworkPriceGood forBuy
Business
2× Intel Xeon E5-2699 v4 (Mumbai / Delhi)
44 / 88 (2.2 GHz base, 3.6 GHz turbo)128 GB DDR4 ECC1 TB NVMe SSD1 Gbps₹17,999/monthBusiness websites, stores, databases, ERP and many client sitesOrder
Enterprise
2× Intel Xeon Platinum 8269CY (Mumbai / Delhi)
52 / 104 (2.5 GHz base, 3.8 GHz turbo)128 GB DDR4 ECC1 TB NVMe SSD1 Gbps₹19,999/monthVirtualization hosts, large databases, SaaS and container platformsOrder
CustomMore RAM or storage, a second server for failover, or several servers for a cluster: quoted by the team.Clusters, failover pairs, unusual specsAsk

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.

Instant UPI • ₹649/mo
Fast KVM Cloud Provisioning