Public key authentication
Public key authentication is the recommended way to sign in to SSH servers. ZestSSH generates, imports and manages SSH keys on every platform. A key’s private half is kept in your device’s secure storage, never in the app’s database.
Availability
Section titled “Availability”| Platform | Status |
|---|---|
| Android | Full support |
| iOS | Full support |
| Windows | Full support |
| macOS | Full support |
| Linux | Full support |
Supported key types
Section titled “Supported key types”Generation
Section titled “Generation”| Key type | Sizes | Notes |
|---|---|---|
| Ed25519 | Fixed | The recommended choice: fast and compact |
| RSA | 2048 or 4096 bits | 4096 bits for servers that need RSA |
| ECDSA | P-256, P-384 or P-521 | For setups that require the NIST curves |
Import
Section titled “Import”ZestSSH reads these private key files:
- OpenSSH format (
-----BEGIN OPENSSH PRIVATE KEY-----), the default ofssh-keygen: Ed25519, RSA, ECDSA and Ed448, with or without a passphrase. - RSA PEM (
-----BEGIN RSA PRIVATE KEY-----), with or without a passphrase. A passphrase-protected one opens when it was encrypted with AES (CBC or CTR). - EC PEM (
-----BEGIN EC PRIVATE KEY-----), without a passphrase only. - PuTTY
.ppk(versions 2 and 3): RSA and Ed25519 keys, with or without a passphrase. ZestSSH converts the key to OpenSSH format as it imports it.
Other files, such as PKCS#8 keys (-----BEGIN PRIVATE KEY-----) and DSA keys, are refused, and ZestSSH says why in your language.
Quick start
Section titled “Quick start”Generate a key on a computer
Section titled “Generate a key on a computer”- Open Keys in the sidebar.
- Choose New key, then Generate SSH key (Ed25519), Generate SSH key (ECDSA) or Generate SSH key (RSA-4096).
- In Generate SSH key, set the Key name, check the key type and strength, and change the Comment if you like (it starts as
user@ZestSSH). - Choose Generate key pair. The public key is shown, with Copy public key and Share public key.
- Choose Save & use this key. The key’s form opens with the new key in it: set the Username and choose Save.
If you close the generator with Done before saving, ZestSSH asks whether to save the key first.
Generate a key on a phone
Section titled “Generate a key on a phone”- Open More, then Keys, and tap +.
- Fill in Display name and Username, and choose SSH key.
- Tap Generate new key, pick the Key format and Key strength, and tap Generate key.
- Tap Save key.
Import an existing key
Section titled “Import an existing key”On a computer:
- Open Keys, choose New key, then Import or paste key.
- Fill in Display name and Username, then choose Set up SSH key.
- In Set up SSH key, use the Paste tab to paste the private key, or the Import tab and Choose key file.
- If the key has a passphrase, ZestSSH asks for it (Key passphrase, then Decrypt).
- Choose Save.
On a phone, open Manage > Keys, tap +, choose SSH key, then Paste key or Import from file (“Load a .pem, .ppk, or OpenSSH key file”), and tap Save key.
The public key is worked out from the private key; you never paste it separately.
Then open the host and pick the key in its Key field.
How it works
Section titled “How it works”Signing in
Section titled “Signing in”- ZestSSH reads the host’s key from secure storage.
- If the key has a passphrase, ZestSSH uses the saved one. If none is saved, it asks (SSH key passphrase), and Remember passphrase saves what you type with the key.
- ZestSSH first asks the server whether it takes the key. The key signs only for a server that says yes, so a key the server would refuse is passed over without signing (and an SSH agent or hardware key is not asked to sign for it).
- An RSA key signs with SHA-512 where the server takes it, otherwise with SHA-256. The old SHA-1 kind is used only where Compatibility mode is on for that host. Where the server takes none of these, the key is not sent and ZestSSH says so.
- The server checks the signature against the public key in
authorized_keys.
A password next to a key
Section titled “A password next to a key”A key can also hold a password in Password, tried after the key. ZestSSH sends it only to a server that does not take the key and asks for a password. Left empty, only the key is used.
Key storage
Section titled “Key storage”| Part | Where it is kept |
|---|---|
| Private key | The system’s secure storage |
| Passphrase (if saved) | The system’s secure storage |
| Certificate (if any) | The system’s secure storage |
| Public key line, name, username | The app’s database |
With Encrypt data at rest on (Settings > Security and privacy), the private key, passphrase and certificate are also sealed with a key that opens only after your PIN.
Where a private key goes
Section titled “Where a private key goes”- Your other devices and backups. A key goes, with its passphrase and certificate, to your other devices through sync, end-to-end encrypted, and into your encrypted backups.
- Export. Export… (on a computer in the key’s details; on a phone, long-press the key, then Key actions) writes OpenSSH key files, with the passphrase the key has, a new one typed twice, or none, and opens the share sheet. On a phone, the key’s editor also has the loaded key’s SSH key dialog, whose copy icon on Private key copies the private key (cleared from the clipboard after 45 seconds), and the download icon, which exports it as a file. See Exporting keys.
- The SSH agent, on a computer. Add to agent gives the key to this computer’s SSH agent for an hour, 8 hours or until you sign out, so other apps (
ssh,git) can sign in with it. See Add a key to the SSH agent. - Mosh and Eternal Terminal. These sessions run an outside program, which gets the key as a temporary file for the session; it is removed when the session ends. On Windows that file is written inside WSL, readable only by your WSL account.
ZestSSH does not write private keys to its logs.
Distributing your public key
Section titled “Distributing your public key”After you generate or import a key, add its public key to each server you want to reach.
Install on hosts
Section titled “Install on hosts”The quickest way: choose Install on hosts… on the key (on a computer, in the key’s details on the Keys page; on a phone, in the key’s editor), pick the hosts, and ZestSSH adds the public key to each host’s ~/.ssh/authorized_keys, the way ssh-copy-id does. See Install a key on hosts.
By hand
Section titled “By hand”- Copy the public key: Copy public key in the key’s details on a computer copies it to the clipboard; on a phone, open the key, choose Manage SSH key, then Public.
- On the server, append it to
~/.ssh/authorized_keys:
echo "ssh-ed25519 AAAA... user@ZestSSH" >> ~/.ssh/authorized_keyschmod 600 ~/.ssh/authorized_keyschmod 700 ~/.sshAn RSA key’s public line starts with ssh-rsa.
Server configuration
Section titled “Server configuration”Make sure the SSH server allows public key authentication:
# In /etc/ssh/sshd_configPubkeyAuthentication yesAuthorizedKeysFile .ssh/authorized_keysManaging keys
Section titled “Managing keys”- Replace on all n hosts…: makes a new key and, host by host, adds it to
authorized_keys, proves it signs in, and only then takes the old key’s line out and points the host at the new key. A host where a step fails keeps the old key working. See Replace a key on all its hosts. - Replace key (computer, in More actions; Rotate in the key’s form): replaces the key’s private key with a new or imported one through Set up SSH key. The hosts that use the key keep using it. Install the new public key on your servers first.
- Passphrase: add, change or remove the key’s passphrase. See Add, change or remove a passphrase.
- Duplicate (computer: right-click the key; phone: swipe the key, or long-press it and tap Key actions): makes a copy with what it signs in with, so the same key can sign in as another username. Allow unattended runs stays off on the copy. Keys held by an SSH agent are not copied this way.
- Allow unattended runs: a switch on each saved key. Scheduled tasks and other automation that run with nobody there sign in only with keys that have it on. See Automation.
Passphrase-protected keys
Section titled “Passphrase-protected keys”A passphrase adds a second lock: someone who copies the key file also needs the passphrase.
- ZestSSH sees that a key has a passphrase when you import it or connect with it.
- When it asks, you can save the passphrase with the key, so it is not asked for again.
- A wrong passphrase stops the connection with: “The passphrase did not open the private key of “key name”. Connect again to enter it once more.”
- The generator does not set a passphrase, but you can add one to any key afterwards with Passphrase (on a computer, Add one under Protection in the key’s details).
- A passphrase saved with a key that no longer has one (removed on another device) is not used: the key opens without it.
Related authentication methods
Section titled “Related authentication methods”- OpenSSH certificates: import or generate a user certificate and attach it to a key. See OpenSSH certificates.
- FIDO2 hardware keys and SSH agents: on a phone, sign in with a key on a security key held to it or plugged in; on a computer, with keys held by your system’s SSH agent, 1Password or Bitwarden. See FIDO2 hardware keys.
Troubleshooting
Section titled “Troubleshooting”“The private key of … is not on this device”
Section titled ““The private key of … is not on this device””The full message is: “The private key of “key name” is not on this device: it was removed, or its import did not finish. Open the key and import its private key again.” Import the key again from your backup, or set up a new one.
“The private key of … on this device cannot be read”
Section titled ““The private key of … on this device cannot be read””The key file in storage is damaged, or of a kind ZestSSH does not know. Nothing was sent to the host. Import the private key again.
Server rejects the key
Section titled “Server rejects the key”ZestSSH shows Key authentication failed: “The server rejected your SSH key.”
- Check that the public key is in
~/.ssh/authorized_keyson the server, for the account you sign in as. - Check permissions:
~/.sshmust be 700 andauthorized_keys600. - Make sure the server’s
sshd_confighasPubkeyAuthentication yes. - Check that
AllowUsersorAllowGroupsdoes not block your user. - Read the server’s log (
/var/log/auth.logorjournalctl -u sshd).
Key works on one server but not another
Section titled “Key works on one server but not another”- A server older than OpenSSH 7.2 takes RSA signatures only with SHA-1. Turn on Compatibility mode for that host (under Auth in a computer’s host editor, behind Advanced options on a phone), or use a key of another kind.
- Check that the right public key is on that server.
Q: Which key type should I choose? A: Ed25519 for most people. It is fast, compact, and every current SSH server takes it (OpenSSH 6.5 and later). Use RSA 4096 only for servers that need RSA.
Q: Can I use the same key for several servers?
A: Yes. Pick the same key in each host’s Key field and add its public key to authorized_keys on each server.
Q: Can I export my private key? A: Yes, on a computer and on a phone: Export… writes OpenSSH key files, and you choose whether the private key file has a passphrase. Your keys are also in your encrypted backups.
Q: Can ZestSSH convert a PuTTY key?
A: Yes. Importing a .ppk file (RSA or Ed25519) converts it to an OpenSSH key.
Q: What happens if I lose my private key? A: If it is in none of your devices, your sync or your backups, it cannot be recovered. Make a new key and add its public key to your servers.