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 желідеміз.