Connect to your server with SSH keys
Updated
SSH is the standard way to log in to a Linux server. An SSH key is safer than a password: it cannot be guessed, and it is not sent over the network. A key has two parts. The private key stays on your computer and is never shared. The public key is safe to share, and goes on the server.
Step 1: check for an existing key
Open a terminal (Linux, macOS) or PowerShell (Windows 10 and 11, which include OpenSSH). Run:
ls ~/.ssh/id_ed25519.pub
On Windows PowerShell use dir $env:USERPROFILE\.ssh\id_ed25519.pub. If the file exists, you can use it and skip to step 3.
Step 2: create an ed25519 key
ssh-keygen -t ed25519 -C "you@example.in"
Press Enter to accept the default file name. Then choose a passphrase. A passphrase protects the key if your laptop is lost or stolen, so we recommend setting one.
This creates two files in the .ssh folder of your user:
id_ed25519is the private key. Never send it to anyone, not even to us.id_ed25519.pubis the public key.
Step 3: send us the public key
Print the public key:
cat ~/.ssh/id_ed25519.pub
On Windows PowerShell: type $env:USERPROFILE\.ssh\id_ed25519.pub. It is one line that starts with ssh-ed25519. Copy that line into your order enquiry or mail it to support@it-labs.in. We add it to the server. If you do not send a key, we send you a login by mail instead, and you can add your key later.
Step 4: first login
We send you the server’s IP address and login by mail. Log in as root:
ssh root@203.0.113.10
Replace the address with your server’s IP address. The first time, SSH asks you to confirm the server’s fingerprint. Type yes once. If you set a passphrase, enter it when asked.
Good habits
- Create a separate key for each computer. Then you can remove one without affecting the others.
- Do not copy your private key to a shared computer, chat, mail or cloud notes.
- If a private key may have been exposed, create a new key and ask us to replace the public key, or remove the old line from
~/.ssh/authorized_keyson the server. - After your key works, create a normal user and turn off password login. See “First steps on a new server”.
If login fails
Run ssh -v root@your-server-ip to see details. “Permission denied (publickey)” usually means the server has a different public key than the one you are using. Mail us the output of ssh -v (it holds no secrets) and we will look.