How to Set Up SSH Keys for Secure VPS Access

Using SSH keys is one of the most secure methods to access your VPS. Unlike passwords, SSH keys cannot be brute-forced easily. This guide explains how to generate and configure SSH keys on various operating systems.

Step 1: Generate SSH Key

Open a terminal and run the command:

ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

Press Enter to save it to the default path ~/.ssh/id_rsa.

Step 2: Copy Public Key to VPS

On Linux/macOS, use:

ssh-copy-id user@your_server_ip

If that command is not available, do it manually:

cat ~/.ssh/id_rsa.pub | ssh user@your_server_ip "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"

Step 3: Set Up SSH Client (Windows)

  • Install PuTTYgen or use ssh-keygen in PowerShell;
  • Generate the key and save both private/public parts;
  • In PuTTY: Go to SSH → Auth → Browse for your private key (.ppk);
  • Connect to the server as usual — no password needed.

Security Tips

  • Never share your private key — it must be kept secret;
  • Use a passphrase for your private key during generation;
  • Disable password login after setting up the key:
sudo nano /etc/ssh/sshd_config
# Change the lines:
PasswordAuthentication no
PermitRootLogin prohibit-password

Then restart SSH service: sudo systemctl restart sshd

← Back to Security section

🤝 Need help configuring SSH keys? Contact Bit.Hosting support — we’ll assist you!

← VPS and Server Security

Bit.Hosting

Compare plans

Pricing is calculated for the selected billing period.