Customer Support

  1. Support
  2. How can I add an SSH key to my Linux server if I have a Windows Operating System?
  1. Home
  2. Dedicated / VPS Management
  3. How can I add an SSH key to my Linux server if I have a Windows Operating System?
  1. Home
  2. myTophost Panel
  3. Management
  4. How can I add an SSH key to my Linux server if I have a Windows Operating System?
  1. Home
  2. myTophost Panel
  3. How can I add an SSH key to my Linux server if I have a Windows Operating System?

How can I add an SSH key to my Linux server if I have a Windows Operating System?

Using SSH keys is a secure and reliable way to connect to your VPS over SSH without a password. In this guide, you’ll see how to create SSH keys on Windows (WSL & PuTTY), and how to use them to connect.


Create an SSH key on Windows 10 / 11 via WSL

If you use the Windows Subsystem for Linux (WSL), you can create SSH keys from a Linux terminal (e.g., Ubuntu).

  1. Open WSL (Start ➝ search e.g. “Ubuntu”).
windows start search ubuntu
  1. Run: ssh-keygen -t ed25519
  2. You’ll be asked to enter a passphrase (optional for extra security).
  3. The files will be saved in ~/.ssh:
    • id_ed25519 (private key)
    • id_ed25519.pub (public key)

Notes:

  • -t ed25519: Sets the key type. ed25519 is the most secure modern choice.
  • -f /path/id_ed25519: (optional) changes the save location.
  • -i -f: (optional) converts an existing key to another format (e.g., SSH2 ➝ OpenSSH).

You’ll also see a fingerprint and a randomart image, useful for verifying the key on remote servers.


Create an SSH key with PuTTYgen (Windows)

  1. Open PuTTYgen from the Start Menu.
windows start puttygen
  1. Select key type: ed25519.
  2. Click Generate and move your mouse over the grey area to complete the process.
puttygen generate key
  1. Once generated:
    • Enter a passphrase (optional).
    • Click Save private key.
    • Copy the public key from the text field (and save it manually as id_ed25519.pub).

Important: “Save public key” stores the key in a different format — copy it manually from the field to use with OpenSSH.

puttygen public key

You can now use the private key from PuTTY:

  1. Open PuTTY ➝ go to Connection > SSH > Auth.
  1. Click Browse and select the private key you saved.
putty pirvate key
  1. (Optional) Add the username in Connection > Data ➝ Auto-login username.
  1. (Optional) Save the setting as a Saved Session for future use.

Add your public key to the VPS

There are two methods:

1. Automatically via ssh-copy-id

  1. Connect to the VPS: ssh user@ip
  2. If not present, create the folder: mkdir ~/.ssh && touch ~/.ssh/authorized_keys
  3. Log out: exit
  4. Run: ssh-copy-id user@ip or sudo ssh-copy-id -i ~/.ssh/id_ed25519.pub user@ip
  5. Optional: add -p 1234 if you use a custom port.
  6. The output will be similar to the screenshot. If prompted to confirm, type yes.

If you see no identities found, make sure the key is in the correct folder or specify the path with -i.

For example:

sudo ssh-copy-id -i ~/.ssh/id_rsa.pub user@123.123.123.123 
sudo ssh-copy-id -i /etc/keys/id_rsa.pub user@123.123.123.123 
sudo ssh-copy-id -i /home/root/id_rsa.pub user@123.123.123.123


2. Manually

  1. Connect to the VPS via SSH.
  2. Create (if missing): mkdir ~/.ssh && touch ~/.ssh/authorized_keys
  3. Open your public key on your computer (e.g., id_ed25519.pub) and copy it.
  4. Open the file: nano ~/.ssh/authorized_keys
  5. Paste the key and save (Ctrl + X ➝ Y ➝ Enter).

Disable password logins

For maximum security, it’s recommended to disable password-based SSH logins:

  1. Edit the file: sudo nano /etc/ssh/sshd_config
  2. Find and set: PasswordAuthentication no
  3. Save and close (Ctrl + X ➝ Y ➝ Enter)
  4. Restart SSH:
    • Ubuntu/Debian: sudo systemctl restart ssh
    • CentOS/AlmaLinux: sudo systemctl restart sshd

You haven't found what you are looking for?

Contact our experts, they will be happy to help!

Contact us