How to set up SSH key authentication
Updated 11/29/2026
SSH keys are a pair of files: one public (on the server) and one private (with you). They are far more secure than passwords and eliminate the risk of brute-force attacks.
1. Generate a key pair (on your computer)
ssh-keygen -t ed25519 -C "[email protected]"
Press Enter for the default location and, optionally, set a passphrase for the key.
2. Copy the public key to the server
ssh-copy-id root@SERVER_IP
Or manually, add it to ~/.ssh/authorized_keys on the server.
3. Test the connection
ssh root@SERVER_IP
You should log in without a password.
4. Disable passwords (once the key works)
In /etc/ssh/sshd_config:
PasswordAuthentication no
systemctl restart ssh
Important
Keep the private key safe and never share it. Continue with disabling root login for extra security.
Put this guide into practice on your own VPS
EU cloud servers, billed hourly, ready in minutes, with one-click installs for dozens of apps.
See pricingRelated tutorials
Single sign-on for your applications with authentik
One account for all your team's apps: first sign-in, users, an OpenID Connect application and two-factor authentication.
Updated 11/29/2026SecurityPasswordless sign-in with Pocket ID
Passkeys for your applications over OpenID Connect: first sign-in, colleagues and connecting an application.
Updated 11/29/2026SecurityHow to scan your server for malware with ClamAV
Install ClamAV, an open-source antivirus, and periodically scan your server for infected files.
Updated 11/29/2026