VPS

Secure Your VPS with SSH Hardening

Essential steps to protect your server

The key steps to secure a new VPS: SSH keys, disabling passwords and a firewall.

Table of contents
  1. 1 Use SSH keys
  2. 2 Disable password login
  3. 3 Firewall

The first thing to do after creating a VPS is to secure SSH access.

Use SSH keys

ssh-keygen -t ed25519
ssh-copy-id user@server

Disable password login

sudo nano /etc/ssh/sshd_config
# PasswordAuthentication no
sudo systemctl restart ssh
Danger

Do not close your current session until key login works from a new session.

Firewall

sudo ufw allow OpenSSH
sudo ufw enable

Was this tutorial helpful?

100% found this helpful.

Comments 0

No comments yet. Be the first to comment.

Leave a comment

Your email is never published.

Related tutorials