How to sign in as root with an SSH key and switch off passwords
Create an SSH key on your computer, add it for root in intoPanel, test it, then switch off password sign-in so SSH cannot be brute-forced.
Passwords can be guessed; a key cannot. Signing in with a key and switching passwords off is the single most effective SSH hardening step.
Step 1: Create a key on your computer#
On Linux, macOS or Windows (PowerShell):
ssh-keygen -t ed25519 -C "you@example.com"Press Enter to accept the file name and set a passphrase. The public key is in ~/.ssh/id_ed25519.pub.
Step 2: Add the key for root#
In the admin area, open Security → Root SSH Keys, paste the one line of id_ed25519.pub, give it a name and add it. Or over SSH:
mkdir -p /root/.ssh && chmod 700 /root/.ssh
echo "ssh-ed25519 AAAA... you@example.com" >> /root/.ssh/authorized_keys
chmod 600 /root/.ssh/authorized_keysStep 3: Test it#
Open a new connection from your computer and keep the old one open:
ssh -i ~/.ssh/id_ed25519 root@your-serverStep 4: Switch off passwords#
In the admin area, open Security → SSH Password Sign-in, untick Accept passwords and click Apply. The panel refuses to do this while root has no key, so you cannot lock yourself out this way.
Keep a way back in#
Keep the private key backed up, and know where your provider's console (VNC or KVM) is. From the console you can always sign in with root's password and add a new key.
Frequently asked questions
Which key type should I use?
Ed25519. It is short, fast and supported by every current SSH client. Use RSA 4096 only for very old clients.
Can hosting accounts use SSH keys?
Yes. Clients with shell access manage their own keys in the client area.
Something missing? Ask in the community or open a ticket.