Linux VPS

Log in with SSH keys and disable passwords

Create an SSH key pair, install it on the server and turn off password logins. · 4 Min. Lesezeit

Diese Seite ist derzeit auf Englisch verfügbar. Eine Übersetzung folgt in Kürze.

SSH keys are much more secure than passwords and stop brute-force attacks.

1. Create a key on your computer

ssh-keygen -t ed25519 -C "you@example.com"

Press Enter to accept the default path and set a passphrase.

2. Copy the key to the server

ssh-copy-id root@YOUR_SERVER_IP

On Windows without ssh-copy-id:

type $env:USERPROFILE\.ssh\id_ed25519.pub | ssh root@YOUR_SERVER_IP "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"

3. Test the login

ssh root@YOUR_SERVER_IP

You should log in without the server password.

4. Disable password login

sudo nano /etc/ssh/sshd_config
# set:
PasswordAuthentication no
PermitRootLogin prohibit-password
sudo systemctl restart ssh

Keep your current session open and test a new login before closing it.

Bestellen Sie einen von Technikern gebauten Server oder schreiben Sie uns — wir sind 24/7 online. Support →

Linux VPS

Alle Anleitungen

Bereit für Ihr Projekt?

Bestellen Sie einen von Technikern gebauten Server oder schreiben Sie uns — wir sind 24/7 online.