Published on

How to Access a Hetzner Server: A Beginner's SSH Guide

To access a Hetzner server, you use a protocol called SSH (Secure Shell - a way to securely send commands to a computer over the internet) via a terminal or command-line interface. For a fresh server, you will typically log in using the username root and the temporary password sent to your email, which takes less than 2 minutes to set up. Most developers today prefer using SSH keys (a pair of digital files that act like an unhackable key and lock) because they offer better security than passwords.

What do you need before getting started?

Before you can log in, you need to have a server ready and the right tools on your own computer. If you haven't created a server yet, you can do so in the Hetzner Cloud Console by selecting a "Server" and choosing an operating system like Ubuntu 24.04 LTS.

You will also need a terminal application to type your commands. If you are on Windows 11, you can use the built-in "Terminal" app or "PowerShell." If you are on macOS or Linux, you can simply open the "Terminal" app that comes pre-installed on your system.

Finally, make sure you have your server's IP address (a unique string of numbers that identifies your server, like 123.123.123.123). You can find this in your Hetzner Cloud dashboard under the "Overview" tab for your specific server.

How do you connect using a password?

Connecting with a password is the easiest way for beginners to start. When you first create a server on Hetzner without an SSH key, they will automatically email you a temporary password.

Open your terminal and type the following command, replacing the example numbers with your actual server IP address.

# Connect as the root user to your specific server IP
ssh [email protected]

What you should see:

The authenticity of host '123.123.123.123' can't be established.
Are you sure you want to continue connecting (yes/no/[fingerprint])?

Type yes and press Enter to tell your computer that you trust this server. Next, the terminal will ask for your password; note that when you type it, no characters or dots will appear on the screen for security reasons.

How do you change your password on the first login?

Hetzner requires you to change the temporary password immediately for security. After you enter the temporary password from your email, the terminal will prompt you for it again.

Type the "current" password first, then press Enter. You will then be asked to type a "new" password and confirm it by typing it a second time.

Make sure your new password is long and complex. We have found that using a password manager to generate a 20-character string is the best way to keep your server safe from automated "brute force" attacks (where hackers use robots to guess thousands of passwords per second).

What you should see:

(current) UNIX password: 
Enter new UNIX password: 
Retype new UNIX password: 
root@your-server-name:~#

How do you connect using SSH keys?

SSH keys are much safer than passwords because they cannot be guessed or easily stolen. An SSH key consists of two parts: a private key that stays on your computer and a public key that you upload to the Hetzner server.

To create these keys, open your terminal and type ssh-keygen -t ed25519. This command creates a modern, highly secure key pair for you.

Press Enter through the prompts to save the file in the default location. You can add a "passphrase" (a password for your key) for extra security, or leave it blank for easier access.

# Generate a new secure SSH key pair
ssh-keygen -t ed25519

Once generated, you need to see your "public" key so you can give it to Hetzner. Use the following command to print the key to your screen.

# Display the content of your public key to copy it
cat ~/.ssh/id_ed25519.pub

Copy the long string of text that starts with ssh-ed25519. You can then paste this into the "Security" section of your Hetzner Cloud Console so that new servers will recognize your computer automatically.

What are the common connection mistakes?

If you see an error that says "Connection timed out," your server might still be booting up. It is normal to wait about 30 to 60 seconds after clicking "Create" in the dashboard before the server is ready to talk to you.

Another common error is "Permission denied (publickey)." This usually happens if you uploaded an SSH key to the Hetzner dashboard but your computer isn't sending the right one, or if you forgot to use the root username.

Always double-check that you are typing the IP address correctly. A single wrong digit will prevent the connection because your computer will be trying to call a "phone number" that doesn't exist or belongs to someone else.

If you get locked out, don't worry. You can always use the "vNC Console" button in the Hetzner dashboard. This opens a small window that acts like a monitor plugged directly into your server, allowing you to fix settings even if the network connection isn't working.

How do you keep your connection secure?

Once you are inside your server, it is a good idea to update the software. This ensures that any known security holes are patched and fixed.

Run these two commands to get the latest updates for your server's operating system.

# Update the list of available software packages
apt update

# Install the latest versions of all current software
apt upgrade -y

What you should see:

Reading package lists... Done
Building dependency tree... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

If the output says "0 upgraded," your server is already fully up to date. It is a great habit to run these commands once a week to keep your data safe.

Next Steps

Now that you can successfully log into your server, you can start installing the tools you need for your project. You might want to look into installing a web server like Nginx or a runtime like Node.js or Python 3.12.

Don't worry if the command line feels intimidating at first. Everyone starts at this point, and with a few days of practice, these commands will become second nature to you.

For more detailed guides, visit the official Hetzner documentation.


Read the Access Documentation