With an SSH key, your computer proves who you are with a key file instead of a password. You log in without typing the password, and nobody can guess the key. On App Hosting, the keys you allow are in the file .ssh/authorized_keys in your home folder; your password keeps working as well. The steps were tested on our demo service, from a computer with OpenSSH. How to connect over SSH at all: SSH how to get connected.
1. Create a Key on Your Computer
Open a terminal: Windows Terminal or PowerShell on Windows 10 and 11, Terminal on macOS and Linux. Run:
ssh-keygen -t ed25519
Press Enter to keep the suggested file. Then enter a passphrase for the key, twice; it protects the key if someone copies it from your computer. You can leave it empty, but then anyone with the file can log in.
This creates two files in the folder .ssh of your user: id_ed25519, the private key, which never leaves your computer, and id_ed25519.pub, the public key, which goes to your service. If you already have a key, you do not need a new one; use the one you have.
2. Copy the Public Key to Your Service
Use your SSH user name and the name of your server, as in the SSH details in the Client Area. On macOS and Linux:
ssh-copy-id username@ds12345.seedhost.eu
It asks for your SSH password once and ends with Number of key(s) added: 1. On Windows, ssh-copy-id is missing; run this in PowerShell instead, as one line:
type $env:USERPROFILE\.ssh\id_ed25519.pub | ssh username@ds12345.seedhost.eu "mkdir -p ~/.ssh && chmod 700 ~/.ssh && cat >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys"
It also asks for your SSH password once.
3. Log In With the Key
ssh username@ds12345.seedhost.eu
You are logged in without your password; only the passphrase of the key is asked for, if you set one. The key works right after you copy it.
4. Remove a Key
Every allowed key is one line in .ssh/authorized_keys, with the name of the key at its end, for example username@laptop. To take the access away from a key, for example of a computer you no longer use, open the file:
nano ~/.ssh/authorized_keys
Delete the line of that key, save with Ctrl+O and Enter, and close with Ctrl+X. The other keys keep working.
The file already contains one key that you did not add, without a name at its end; it is there from the start of each service. Leave that line as it is.
Good to Know
- Never send the private key
id_ed25519to anyone, also not to our support. Only the file ending in.pubmay be shared. - Create a separate key on each computer, so that you can take away the access of one of them without changing the others.
- If you lose your key, log in with your password and add a new key.
- On a Dedicated Server with root access, you can also switch off password login: Log In to Your Linux Server With an SSH Key.