Disclosure: this page contains affiliate links. If you buy through them we may earn a commission at no extra cost to you.
SSH keys are safer than passwords and make logins passwordless. Here’s how to set them up and disable password auth.
Step 1: Generate a key pair (on your computer)
ssh-keygen -t ed25519 -C "you@example.com"
This creates ~/.ssh/id_ed25519 (private) and id_ed25519.pub (public). Never share the private key.
Step 2: Copy the public key to the VPS
ssh-copy-id root@your-vps-ip
Step 3: Test and harden
Log in with the key, then disable password login in /etc/ssh/sshd_config:
PasswordAuthentication no
PermitRootLogin prohibit-password
Reload with:
sudo systemctl reload ssh
Before you close the session, open a second terminal and confirm key login works — locking yourself out is the classic mistake.
Keep a backup of your private key, and consider an SSH config alias for quick access. This works on any VPS with full root; RackNerd’s 1 GB plan at $21.99/yr is a fine place to start.
See RackNerd's current deals