Skip to content
PK Hosting
VPS & servers

Harden SSH on your VPS

Disable password logins, use keys, change the default port only if you understand the risk, and keep a rescue path.

Last updated

Do this on a VPS or dedicated server you administer β€” not on shared hosting, which has no shell.

  1. Add your public key to ~/.ssh/authorized_keys and confirm key login works.
  2. Disable root password login in sshd_config (PasswordAuthentication no, PermitRootLogin prohibit-password).
  3. Create a sudo user and keep a second session open while you reload sshd.
  4. Optionally move SSH off port 22 and pair it with Fail2ban.

PKHosting will never ask you for your SSH private key or account password.

Still need a hand?

Open a ticket from your dashboard with your domain and a screenshot β€” our team replies fast.