Skip to content
Current coupon:10% offUse it in your order

SSH key: log in without a password (ed25519, PuTTYgen)

Create an ed25519 SSH key, upload it to your VPS and safely turn off password login. Steps for Windows, macOS, Linux and PuTTY, including ssh-agent and the ~/.ssh/config file.

  • beginner
  • ~15 min
  • Updated 1 Oct 2026

You'll create an SSH key, upload it to your VPS and log in without a password. Finally you'll turn off password login, so guessing passwords becomes pointless. The steps cover Windows, macOS, Linux and PuTTY.

What you'll need

  • A StormHost VPS with Ubuntu 24.04 or Debian 13
  • A working SSH connection with a password (guide)
  • A computer with Windows 10/11, macOS or Linux
  • About 15 minutes

How an SSH key works#

An SSH key consists of two files that belong together:

FileExample nameWhere it livesWho to give it to
Private keyid_ed25519 (PuTTY: .ppk)Only on your computer.Nobody. Whoever has it can log in as you.
Public keyid_ed25519.pubOn the VPS in the file ~/.ssh/authorized_keys.You can put it anywhere; it can't be misused.

When you log in, the VPS sends your computer a challenge that only the holder of the private key can solve. The private key never leaves your computer. An ed25519 key is modern, short and secure, and all current systems support it.

You can also lock the private key with a key password (passphrase). If someone copies your key file, they can't use it without this password.

Creating a key#

Windows

  1. Open Terminal (right-click Start › Terminal; in Windows 10 Windows PowerShell).

  2. Run:

    PowerShell
    ssh-keygen -t ed25519 -C "notebook-jan"
  3. At the question Enter file in which to save the key (C:\Users\jan/.ssh/id_ed25519): press Enter. The key is saved to the default location, where SSH finds it by itself.

  4. At Enter passphrase, enter a key password and press Enter. At Enter same passphrase again, repeat it. The password doesn't show. If you leave it empty, the key won't be locked.

Result: the files C:\Users\<USER>\.ssh\id_ed25519 (private) and id_ed25519.pub (public).

macOS

  1. Open the Terminal app.

  2. Run:

    bash
    ssh-keygen -t ed25519 -C "macbook-jan"
  3. At the question Enter file in which to save the key, press Enter.

  4. Enter and repeat the key password (passphrase).

Result: ~/.ssh/id_ed25519 and ~/.ssh/id_ed25519.pub.

Linux

  1. Open a terminal.

  2. Run:

    bash
    ssh-keygen -t ed25519 -C "pc-jan"
  3. At the question Enter file in which to save the key, press Enter.

  4. Enter and repeat the key password (passphrase).

Result: ~/.ssh/id_ed25519 and ~/.ssh/id_ed25519.pub.

What the command does:

  • ssh-keygen – a program for creating SSH keys.
  • -t ed25519 – the key type. We recommend Ed25519. Use the older RSA type only for devices that can't do ed25519, and then with the length -t rsa -b 4096.
  • -C "notebook-jan" – a label (comment) at the end of the public key. It tells you on the VPS which computer the key is from. The label doesn't secure anything; it's just for orientation.

Already have a key?

When ssh-keygen says … already exists. Overwrite (y/n)?, answer n. Overwriting would lose your old key and your access everywhere you use it. Feel free to use the old key for the VPS too.

Creating a key in PuTTYgen#

If you connect with PuTTY, create the key in PuTTYgen, which is installed together with PuTTY.

  1. Start PuTTYgen.
  2. Under Parameters, choose the type EdDSA and next to it Ed25519 (255 bits).
  3. Click Generate and move the mouse over the empty area of the window until the progress bar fills up. The mouse movement serves as a source of randomness.
  4. In the Key comment field, type a label, for example notebook-jan.
  5. In the Key passphrase and Confirm passphrase fields, enter a key password.
  6. Click Save private key and save the file, for example C:\Users\<USER>\.ssh\vps.ppk. This is the private key.
  7. Select and copy all the text in the Public key for pasting into OpenSSH authorized_keys file field. It starts with ssh-ed25519 AAAA… and ends with the label. This is the public key, which you upload to the VPS by hand (see the Manually tab below).

The Save public key button saves the public key in a different format that the VPS won't accept. Always copy the text from the field.

Uploading the public key to the VPS#

Windows

Windows doesn't have the ssh-copy-id command. This PowerShell command does the same job (replace 203.0.113.10 with your VPS IP address):

PowerShell
type $env:USERPROFILE\.ssh\id_ed25519.pub | ssh [email protected] "mkdir -p ~/.ssh && chmod 700 ~/.ssh && cat >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys"
  • type $env:USERPROFILE\.ssh\id_ed25519.pub – prints the contents of the public key ($env:USERPROFILE is your C:\Users\<USER> folder).
  • | – passes the output as input to the next command.
  • ssh [email protected] "…" – connects to the VPS (asks for the root password) and runs the commands in quotes.
  • mkdir -p ~/.ssh – creates the .ssh folder if it doesn't exist yet.
  • chmod 700 ~/.ssh – only the owner can open the folder. SSH rejects permissions that are too open.
  • cat >> ~/.ssh/authorized_keys – appends the key to the end of the file. Keys already there stay.
  • chmod 600 ~/.ssh/authorized_keys – only the owner can read and change the file.

macOS

bash
ssh-copy-id -i ~/.ssh/id_ed25519.pub [email protected]
  • ssh-copy-id – uploads the public key to the server and sets the right permissions.
  • -i ~/.ssh/id_ed25519.pub – which key to upload.
  • [email protected] – the user and address of the VPS.

It asks for the root password and finally prints Number of key(s) added: 1.

Linux

bash
ssh-copy-id -i ~/.ssh/id_ed25519.pub [email protected]
  • ssh-copy-id – uploads the public key to the server and sets the right permissions.
  • -i ~/.ssh/id_ed25519.pub – which key to upload.

It asks for the root password and finally prints Number of key(s) added: 1.

Manually

Useful for a key from PuTTYgen or when the previous methods don't work for you.

  1. Connect to the VPS with a password (PuTTY, a terminal or the browser console).

  2. Prepare the folder and open the keys file:

    bash
    mkdir -p ~/.ssh && chmod 700 ~/.ssh
    nano ~/.ssh/authorized_keys
  3. Paste the public key on a line of its own (in PuTTY with a right-click). The whole key must be on one line: ssh-ed25519 AAAA… comment.

  4. Save (Ctrl+O, Enter) and close the editor (Ctrl+X).

  5. Set the permissions:

    bash
    chmod 600 ~/.ssh/authorized_keys

Logging in with the key#

The SSH client finds a key in the default location (id_ed25519) by itself, so the usual command is enough:

bash
ssh [email protected]

If you set a password for the key, the client asks Enter passphrase for key. You enter the key password, not the root password.

You specify a key stored elsewhere or under a different name with the -i option:

bash
ssh -i ~/.ssh/vps_klic [email protected]
  • -i ~/.ssh/vps_klic – the path to the private key (the file without .pub).

PuTTY:

  1. Start PuTTY and load the saved session (Load), or fill in the IP address.
  2. In the tree on the left, open Connection › SSH › Auth › Credentials.
  3. Next to the Private key file for authentication field, click Browse and choose the .ppk file.
  4. Optional: under Connection › Data, fill in Auto-login username with root.
  5. Go back to Session, click the session name and Save, so you don't have to set this up next time.
  6. Click Open.

You can use a key from ssh-keygen in PuTTY too: in PuTTYgen click Load, choose the id_ed25519 file (switch the file filter to All Files) and save it with Save private key as .ppk. The other way round, you convert a PuTTYgen key to the OpenSSH format with Conversions › Export OpenSSH key.

ssh-agent: enter the key password only once#

ssh-agent remembers the unlocked key, so you don't enter the key password on every connection.

Windows

In PowerShell run as administrator, turn on the agent service (it's off by default):

PowerShell
Get-Service ssh-agent | Set-Service -StartupType Automatic
Start-Service ssh-agent
  • Set-Service -StartupType Automatic – the agent starts with the system.
  • Start-Service ssh-agent – starts the agent now.

Then add the key in a regular window (it asks for the key password):

PowerShell
ssh-add $env:USERPROFILE\.ssh\id_ed25519

macOS

bash
ssh-add --apple-use-keychain ~/.ssh/id_ed25519
  • --apple-use-keychain – saves the key password to the macOS Keychain.

To have SSH use the password from Keychain automatically even after the Mac restarts, add this to the beginning of the ~/.ssh/config file (see the next section):

~/.ssh/configtext
Host *
    UseKeychain yes
    AddKeysToAgent yes
  • UseKeychain yes – the key password is loaded from Keychain (macOS only).
  • AddKeysToAgent yes – the unlocked key is added to the agent the first time it's used.

Linux

Most desktop environments start the agent by themselves. Add the key with:

bash
ssh-add ~/.ssh/id_ed25519

To check: ssh-add -l lists the fingerprints of the keys the agent has loaded.

The ~/.ssh/config file: connect with one word#

Save your VPS settings in the config file in the .ssh folder (Windows: C:\Users\<USER>\.ssh\config, no extension):

~/.ssh/configtext
Host mojevps
    HostName 203.0.113.10
    User root
    Port 22
    IdentityFile ~/.ssh/id_ed25519
    IdentitiesOnly yes
DirectiveWhat it does
Host mojevpsThe shortcut you'll type instead of the address. Applies to the lines below it.
HostNameThe real IP address or domain of the VPS.
UserThe user you log in as.
PortThe SSH port. Change it if you moved SSH to a different port.
IdentityFileThe private key for this VPS.
IdentitiesOnly yesTry only the key from IdentityFile, not all keys from the agent. Prevents the Too many authentication failures error.

Then you connect with ssh mojevps. scp and sftp use the shortcut too.

Turning off password login#

As long as password login is on, bots can keep trying it. Once it's off, the VPS accepts only a key.

What turning off passwords affects in the customer area

The Files and Database tabs log in to the VPS with a password. Once passwords are off, they stop working. Then transfer files with an SFTP client using your key (both WinSCP and FileZilla support keys) and manage the database through an SSH tunnel. The browser console keeps working. An overview of all the effects is in the Securing a new VPS guide.

First check that key login works

If you turn off passwords and the key doesn't work, you won't be able to log in over SSH. Before you continue, open a new window and log in with the key without entering the root password. Keep the original window open the whole time. If something still goes wrong, log in through the browser console with the root password and delete the file from step 1.

  1. Create (or open) your own SSH server configuration file:

    bash
    nano /etc/ssh/sshd_config.d/00-zabezpeceni.conf
  2. Paste the settings:

    /etc/ssh/sshd_config.d/00-zabezpeceni.confini
    PasswordAuthentication no
    KbdInteractiveAuthentication no
    PubkeyAuthentication yes
    PermitRootLogin prohibit-password

    If the file already has PermitRootLogin no (from the Securing a new VPS guide), leave out the last line.

    SettingWhat it doesRecommended valueWhen to change
    PasswordAuthenticationAllows password login.noNever, if you want passwords off.
    KbdInteractiveAuthenticationAnother way of entering a password (an interactive prompt). Even with PasswordAuthentication off, a password could be entered through it.noyes only for two-factor authentication through PAM (advanced).
    PubkeyAuthenticationAllows key login. The default value is yes; we list it to be safe.yesNever.
    PermitRootLoginRoot login. prohibit-password = root only with a key.prohibit-passwordno, if you work under your own user with sudo.
  3. Save and close the editor.

  4. Check that exactly your values apply:

    bash
    sshd -t && sshd -T | grep -Ei "^(passwordauthentication|kbdinteractiveauthentication|pubkeyauthentication|permitrootlogin)"
    • sshd -t – checks the configuration syntax. On an error it prints the file and line, and the next command doesn't run.
    • sshd -T – prints the resulting effective configuration after loading all files.
    • grep -Ei "…" – picks out only the four settings you're checking.

    The output must contain these four lines (the order may differ):

    Outputtext
    permitrootlogin without-password
    pubkeyauthentication yes
    passwordauthentication no
    kbdinteractiveauthentication no

    without-password is the older name for prohibit-password and means the same. Ubuntu 24.04 and Debian 13 print the older name; newer OpenSSH versions print prohibit-password. If you set no, you'll see permitrootlogin no.

    If any line shows a different value (typically passwordauthentication yes), the same setting is in a file that loads earlier. Find it with grep -rni "passwordauthentication" /etc/ssh/sshd_config.d/. Comment out the line there with a # at the beginning and repeat the check.

  5. Restart the SSH server:

    bash
    systemctl restart ssh

    The current connection stays open.

  6. In a new window, try to force a password login:

    bash
    ssh -o PubkeyAuthentication=no [email protected]

    The server must reply Permission denied (publickey). That's correct: it no longer accepts passwords.

  7. In another window, log in normally with the key (ssh [email protected]). Only when that works, close the original window.

Why the 00-⁠zabezpeceni.conf file

The SSH server first reads the files in the /etc/ssh/sshd_config.d/ folder (in alphabetical order) and then the main /etc/ssh/sshd_config. For each setting, the first value found applies. The VPS may have a file like 50-cloud-init.conf with PasswordAuthentication yes. Thanks to the number 00, your file loads first and its values win. The sshd -T check always confirms this for you.

Multiple computers, removing and backing up a key#

  • Another computer: create its own key with a different label and upload it the same way. Each key is on a separate line in ~/.ssh/authorized_keys. We don't recommend copying one private key between computers.
  • Removing a key (a lost laptop, a colleague leaving): open nano ~/.ssh/authorized_keys and delete the line with its label. It takes effect immediately.
  • Backup: store the private key in a password manager or on encrypted storage. If you lose it and have passwords turned off, log in through the browser console and upload a new public key.
  • A user other than root: the key goes in /home/<USER>/.ssh/authorized_keys and that user must own the file.

Verification#

  • ssh root@<VPS_IP_ADDRESS> logs you in without the root password (at most it asks for the key password).
  • ssh -o PubkeyAuthentication=no root@<VPS_IP_ADDRESS> ends with Permission denied (publickey).
  • sshd -T shows passwordauthentication no.

Troubleshooting#

The VPS still asks for the root password#

The key wasn't used. Connect with verbose output:

bash
ssh -v [email protected]
  • -v – verbose output. Look for the lines Offering public key (the client offered the key) and Server accepts key (the server accepted it).

If the client doesn't offer the key, it's in a different file: use -i or IdentityFile. If the server doesn't accept it, check the permissions on the VPS:

bash
chmod 700 ~/.ssh && chmod 600 ~/.ssh/authorized_keys
journalctl -u ssh -n 30
  • journalctl -u ssh -n 30 – the last 30 SSH server entries. The message Authentication refused: bad ownership or modes means wrong permissions or a wrong owner of the .ssh folder.

Also check that the key in authorized_keys is on one line and starts with ssh-ed25519.

Permission denied (publickey).#

Passwords are off and the server didn't accept the key. Proceed as in the previous point. If you can't log in at all, use the browser console.

Windows: WARNING: UNPROTECTED PRIVATE KEY FILE! or Bad permissions#

Other users of the computer also have access to the private key (typically after copying it from somewhere else) and the client refuses to use it. Set the permissions in PowerShell:

PowerShell
icacls $env:USERPROFILE\.ssh\id_ed25519 /inheritance:r
icacls $env:USERPROFILE\.ssh\id_ed25519 /grant:r "$($env:USERNAME):(R)"
  • /inheritance:r – removes the permissions inherited from the folder.
  • /grant:r "<USER>:(R)" – gives only your account permission to read.

On macOS and Linux you fix the same error with chmod 600 ~/.ssh/id_ed25519.

Load key "…": invalid format#

You're trying to use a key in PuTTY format (.ppk) with OpenSSH. Convert it in PuTTYgen with Conversions › Export OpenSSH key.

PuTTY: Server refused our key#

The right public key isn't on the VPS. Copy the text from the Public key for pasting into OpenSSH authorized_keys file field again (not the file from Save public key) and paste it into ~/.ssh/authorized_keys on one line.

Too many authentication failures#

The agent offers too many keys. Use IdentitiesOnly yes in ~/.ssh/config, or the options -i ~/.ssh/id_ed25519 -o IdentitiesOnly=yes.

Summary

  • The private key stays only on your computer; the public key goes in ~/.ssh/authorized_keys on the VPS.
  • Create the key with ssh-keygen -t ed25519 -C "comment" or in PuTTYgen (EdDSA, Ed25519).
  • Uploading: ssh-copy-id (macOS, Linux), on Windows type … | ssh …, or by hand.
  • Turn off passwords with the file /etc/ssh/sshd_config.d/00-zabezpeceni.conf and verify the result with sshd -T.
  • Before closing the original window, always test key login in a new window.
  • Turning off passwords also disables the Files and Database tabs; the console keeps working.

Search the guides