Quick answer
How do I secure SSH on a VPS?
Here is how to secure SSH on a VPS: log in with an ed25519 key, then turn password login off with PasswordAuthentication no in a file under /etc/ssh/sshd_config.d/. Reload SSH and test from a second window before closing the first. A TunnelVPS server ordered with a key already has password login off. It takes 5 steps.
In brief
- Key:
ssh-keygen -t ed25519on your computer; the public half goes on the server. - Passwords off:
PasswordAuthentication noandKbdInteractiveAuthentication no. - Root:
PermitRootLogin prohibit-passwordallows root by key only. - Safety net: keep one session open while testing from another.
What are the 5 steps to lock SSH to keys?
| Step | Where | What to do |
|---|---|---|
| 1 | Your computer | Create a key with ssh-keygen -t ed25519 if you have none. |
| 2 | Server | Add the public key to /root/.ssh/authorized_keys and test a key login. |
| 3 | Server | Write PasswordAuthentication no and related lines in /etc/ssh/sshd_config.d/. |
| 4 | Server | Reload SSH with systemctl reload ssh. |
| 5 | Second window | Log in again with the key before closing the first session. |
Why does SSH matter on a VPN server?
Because whoever gets root over SSH gets every VPN key on the server. The SSH port faces the internet, and password guessing against it never stops. A key cannot be guessed the way a password can.
The VPN keys and client list live only on the server. Protecting SSH protects them. Learning how to secure SSH on a VPS takes ten minutes and is the first job after delivery.
Where does a TunnelVPS server start?
With password login already off if you gave a public key at checkout. Root logs in over SSH. A public key given at checkout is installed and password login stays off; without a key, the team sets a temporary root password, shown in the dashboard, to change with passwd at first login.
Without a key, you log in once with the temporary password and change it with passwd. Then add a key and follow the steps below. The first SSH login guide shows how to create the key and where to paste it.
ssh-keygen -t ed25519
cat ~/.ssh/id_ed25519.pubWhich settings turn password login off?
PasswordAuthentication no, plus KbdInteractiveAuthentication no for the other password route. TunnelVPS read the Debian sshd_config manual on 16 November 2026. Upstream, both default to yes. PermitRootLogin defaults to prohibit-password, which already blocks passwords for root.
The same manual notes that Debian includes /etc/ssh/sshd_config.d/*.conf at the start of the main file. Settings there override the main file, so a small drop-in is cleaner than editing sshd_config.
PasswordAuthentication no
KbdInteractiveAuthentication no
PermitRootLogin prohibit-password
PubkeyAuthentication yesHow do you apply the change without locking yourself out?
Reload SSH, keep the current session open, and log in from a second window. A reload keeps existing sessions alive. If the new login fails, fix the file from the session that is still open.
If both sessions are lost, the server page may show a control panel card with a console and rescue mode. The late or down guide lists what to do for each status.
systemctl reload ssh
# in a second terminal on your computer:
ssh [email protected]What else helps beyond keys?
A firewall that allows only SSH and the VPN ports, and regular updates. The UFW guide allows SSH before enabling anything, so the session survives. The update guide keeps OpenSSH patched.
Keep the private key on your own devices only. TunnelVPS cannot recover a lost private key and never asks for it. A spare key on a second device avoids being locked out. Those habits complete how to secure SSH on a VPS for the long run.
SSH questions
Should I change the SSH port?
It reduces log noise but adds little security once passwords are off. If you change it, allow the new port in the firewall first.
What is the best way to secure SSH on a VPS in 2026?
Key-only login with an ed25519 key, password and keyboard-interactive login off, and a firewall limited to the ports you use.
Can I add a second key?
Yes. Add one public key per line in /root/.ssh/authorized_keys, for example one per computer.
Does the AmneziaVPN app still work with password login off?
Yes. Give it your SSH private key instead of a password; it runs on your own device.
What if I lose my only private key?
Use the console from the control panel card, when one shows, or reinstall the server. A reinstall erases the disk, VPN keys included.
Verdict
- Keys only, passwords off, set in a drop-in file under
sshd_config.d. - Always test from a second window before closing the first.
Sources (3)
- sshd_config(5) manual page (Debian) — Debian (read 2026-11-16)
- ufw(8) manual page — Ubuntu (read 2026-11-16)
- Amnezia: install VPN on your server — Amnezia (read 2026-11-16)
Order with your key
Paste your public key at checkout and password login stays off from the start. Home costs $6.37 a month on 12 months.
- Built by a person, 1 hour at most after confirmation
- Lost days credited back if a server cannot be delivered
- Pay in BTC, XMR, USDT, USDC, ETH, SOL or LTC
- DomaineGoat LLC · Panama