Skip to main content

How to harden SSH security on your Linux VPS

Sabrina Goom avatar
Written by Sabrina Goom
Updated over a month ago

To harden the SSH security on your Linux VPS, you can try the following:

Edit the SSH config file with:

nano /etc/ssh/sshd_config

Change the default port from 22 to something custom: Port 2222

Additionally, try disabling root login: PermitRootLogin no

Also enable public key authentication: PasswordAuthentication no

Finally, restart SSH with:

systemctl restart sshd

Always test new settings in a secondary session before closing the original.

We also recommend setting up a firewall to only allow inbound SSH traffic from whitelisted IP addresses.

Did this answer your question?