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 хв читання

Ця сторінка поки доступна англійською. Переклад з’явиться найближчим часом.

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.

Замовте сервер, налаштований живими інженерами, або напишіть нам — ми онлайн 24/7. Підтримка →

Linux VPS

Усі інструкції

Готові запустити проєкт?

Замовте сервер, налаштований живими інженерами, або напишіть нам — ми онлайн 24/7.