On a Hetzner Cloud server, open a terminal and run ssh root@<your-server-IP>, replacing the placeholder with the IPv4 or IPv6 address shown in the Hetzner Console. If you attached an SSH key when the server was created, the login completes automatically unless the key has a passphrase, in which case you enter that passphrase. If you created the server without a key, enter the root password Hetzner emailed you and change it when prompted.
The rest of this guide explains each part of that command, the differences between Hetzner product lines, how to set up key authentication, and what to check when a connection fails.
What the SSH Command Does
The command has three parts. ssh starts the OpenSSH client on your local machine. root is the remote username. Everything after the @ is the server address.
For a Hetzner Cloud server with IPv6, use the first address of the assigned /64 network rather than the network prefix itself. The Console shows the address you should copy, so the simplest approach is to use the value displayed there.
If your server listens on a different port, add -p followed by the port number. The Hetzner documentation supplied here names port 22 only, so treat any other port as something you or your administrator configured deliberately.
Before You Connect
You need four things ready:
- The server's IP address or hostname, copied from the Hetzner Console or Robot panel.
- The correct username for your product line and image.
- A credential: an SSH key that matches one stored on the server, or a password.
- A terminal on your local machine (Terminal on macOS and Linux, PowerShell or another SSH client on Windows).
A key belongs to a specific Hetzner Cloud project. Keys are not shared between projects, so a key you added in one project will not authenticate a server in another until you add it there too.
Cloud, Dedicated, and Managed Servers Compared
The login details depend on which Hetzner product you are using. The table below summarizes what the official documentation describes.
| Product | Username | Typical credential | Notes |
|---|---|---|---|
| Cloud server with SSH key | root |
SSH private key (plus passphrase if set) | Login completes automatically without a passphrase |
| Cloud server without SSH key | root |
Root password emailed at creation | Password change required on first login |
| Dedicated (Robot) server | Usually root |
Password | Port 22 opened if necessary; fingerprint prompt on first connect |
| Managed product | Main FTP user's login name | As provided with the product | Hostname used as the address; fingerprint confirmation on first connect |
For dedicated servers, the documented flow is to open SSH and port 22 if needed, then enter your username (usually root) and password. The supplied Robot documentation does not describe key-based setup in detail, so the key instructions below are scoped to Cloud servers.
Creating and Attaching an SSH Key
Key authentication is more convenient than typing a password for every login. It also avoids sending a password to the server at all.
How the Key Pair Works
An SSH key pair has two halves. The public key is placed on the server, and the private key stays on your local machine. Only the matching private key can decrypt what the public key encrypts, and both must belong to the same pair. Keep the private key secret and never share it.
Generating the Key
Run ssh-keygen in your local terminal. With no options it creates an RSA key by default. Hetzner's guide recommends Ed25519 when your device supports it, with RSA as the fallback. For RSA, the default size is 3072 bits, keys should never be under 1024 bits, and 4096 bits can be set for more security.
When prompted for a file location, keep the default so the SSH client can find the key automatically during authentication. Setting a passphrase adds protection, and you will be asked for it each time the key is used. Hetzner's Cloud key tutorial strongly recommends a passphrase.
Adding the Public Key in the Cloud Console
In the Hetzner Cloud Console, open your project, select Security in the sidebar, and click Add SSH Key. Display the public key file with cat, for example cat ~/.ssh/id_ed25519.pub, and paste its contents into the console. The public key is the half the server needs to authenticate you.
You can add the key at server creation time, or add it to the project and attach it to a server afterward. Because keys are per project, repeat this step in every project where you need access.
Your First Login and the Fingerprint Prompt
On the first connection, the SSH client may warn you about the host's authenticity. Entering yes accepts the fingerprint and stores it locally. The accepted entry is saved in ~/.ssh/known_hosts on your machine.
Dedicated servers show a similar prompt asking you to examine the fingerprint on first connect. Managed products also ask you to verify and confirm the fingerprint the first time you connect. Compare the fingerprint against the value shown in the Hetzner panel before accepting it.
After the fingerprint step, authentication proceeds. With a key and no passphrase, you land at a shell prompt directly. With a password-based Cloud server, you enter the emailed root password and are then asked to change it.
Fixing Common Login Failures
When a login fails, the cause is usually one of a few things:
- Permission denied. The username is wrong, the key on the server does not match your private key, or the server expects a password but you are offering a key. Check which credential type the server was provisioned with.
- Wrong username. Cloud servers documented here use
root, but other images or configurations may differ. Managed products use the main FTP login name. - Wrong address or port. Confirm you copied the correct IP, and for IPv6 use the first address of the /64 rather than the network itself. If you changed the SSH port, specify it with
-p. - Key permissions. The private key must be readable only by you. Loose permissions on the key file can cause the client to refuse it.
- Key in the wrong project. A key added to one Cloud project does not authenticate servers in another.
If you still cannot get in, the next section describes recovery paths.
Fallback Options When SSH Fails
Replacing a Lost Key via the Rescue System
If you have lost access and need to install a new key, Hetzner Cloud provides a rescue system procedure. You boot the server into rescue mode, mount the root partition, create a chroot environment, and add the new key. This requires console access to the Hetzner panel rather than a working SSH session.
Restricting SSH Exposure
As an advanced option, you can block incoming traffic to the SSH port with a Hetzner Firewall and connect through a script instead of exposing the SSH server directly to the internet. This reduces the attack surface but adds a setup step before every connection, so it suits administrators who want tighter control more than casual users.
Shortening Repeat Logins with an SSH Config Entry
If you log in often, an entry in ~/.ssh/config lets you connect with a short alias instead of the full command. The entry uses Host, HostName, User, and PreferredAuthentications so that typing ssh plus the alias replaces ssh user@address.
Host myserver
HostName 203.0.113.10
User root
PreferredAuthentications publickey
If the server has no SSH key attached and you log in by password, change PreferredAuthentications from publickey to password. After saving the file, run ssh myserver to connect.
Wrapping Up
The core login is one command: ssh root@<server-IP> for a Cloud server with a key, or with the emailed root password if no key was attached. Beyond that first connection, the practical steps are to generate a key pair, keep the private half local and protected with a passphrase, add the public half to the right Cloud project, and accept the host fingerprint on first connect. When something breaks, check the username, the credential type, the address, and which project holds the key before reaching for the rescue system.


