SSH is the main way to manage a Linux VPS, so it should be secured before the server is used for public services. Start by adding an SSH key and a sudo user, then reduce password-based access where possible.
- Add an SSH key: How to add an SSH key to your VPS.
- Create a sudo user: How to create a sudo user on a Linux VPS.
- Test that the sudo user can log in with the SSH key.
- Edit the SSH config:
sudo nano /etc/ssh/sshd_config
Common hardening options are:
PermitRootLogin no PasswordAuthentication no
Restart SSH after saving:
sudo systemctl restart ssh
Keep your current SSH session open while testing a new login. If the new login fails, you can still fix the config from the existing session or VPS console.
