Password-based SSH access is susceptible to automated dictionary and brute-force attacks. Using cryptographic SSH key pairs is the industry standard for securing Linux servers.

1. Generate an SSH Key Pair (Local Machine)

Open Terminal (Mac/Linux) or PowerShell (Windows) on your computer and run:

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

Press Enter to accept the default file location. You may optionally enter a passphrase for extra protection.

2. Copy Public Key to Your VPS

Run the following command, replacing the user and IP with your server's credentials:

ssh-copy-id -i ~/.ssh/id_ed25519.pub root@YOUR_SERVER_IP

3. Disable Password Authentication (Optional & Recommended)

Once you verify that you can log in using your key, edit /etc/ssh/sshd_config on your server:

PasswordAuthentication no
PubkeyAuthentication yes

Restart the SSH daemon (sudo systemctl restart sshd). You now have uncrackable, key-only SSH protection.

Was this answer helpful? 0 Users Found This Useful (0 Votes)