-
Generate a key pair on your local machine:
ssh-keygen
-
Copy the public key to your VPS:
ssh-copy-id user@your-ip
-
Edit the SSH config:
sudo nano /etc/ssh/sshd_config
-
Ensure
PasswordAuthentication no
is set -
Restart SSH:
sudo systemctl restart sshd
This significantly increases login security by eliminating password-based access.