A password can be guessed or stolen through a phishing page; a private key never leaves your computer. That’s why many server admins turn off password logins entirely and accept only keys, which makes brute-force attacks fail automatically.
How it works
- You create the key pair on your computer.
- You add the public key to
~/.ssh/authorized_keyson the server. - When you connect, the server sends a challenge only the holder of the private key can answer.
- Your computer answers it, and the server confirms who you are without the private key ever crossing the network.
Example: creating and using a key
ssh-keygen -t ed25519 -C "[email protected]"
cat ~/.ssh/id_ed25519.pub
The first command creates two files:
| File | Contains | Share it with |
|---|---|---|
~/.ssh/id_ed25519 |
The private key | Nobody, ever |
~/.ssh/id_ed25519.pub |
The public key | Servers, GitHub, any service you log in to |
The second prints the public key so you can copy it. Once it’s on the server, connect like this:
ssh -i ~/.ssh/id_ed25519 [email protected]
If you protected the key with a passphrase, run ssh-add ~/.ssh/id_ed25519 once and ssh-agent holds it for the session, so you don’t retype it on every connection.
Common problems
Permission denied (publickey): the public key isn’t installed, you’re offering a different key, or permissions are wrong. See that error’s page.- Permissions too open: SSH refuses keys when
~/.sshorauthorized_keysis writable by others, or when the private key is readable by others. The safe values are700for the folder and600for the key files; work them out with the chmod calculator. - Pasting the private key instead of the public one: the public key is the file ending in
.pub, starting withssh-ed25519.
On ArabyHost
SSH is available on AI/Developer plans, jailed in CageFS. Add your key in cPanel under Security → SSH Access → Manage SSH Keys: import the public key, then click Authorize. After that you can log in with the key and run Git, Claude Code and Codex. Full steps are in the set up SSH keys guide, and plan details are on the developers page.
FAQ
Can I use the same key on several servers?
Yes, you can put the same public key on any number of servers. But if the private key is stolen they're all exposed, so some people prefer one key per computer they work from.
What is the passphrase for?
It encrypts the private key on your computer, so a stolen key file is useless without it. With ssh-agent you only type it once per session.
Which type should I choose, Ed25519 or RSA?
Ed25519 is the modern default: shorter, faster and secure. Use 4096-bit RSA only for an old system that doesn't support Ed25519.