SSH Key Management on iOS: The Practical Guide
Your private key is the only thing standing between a lost phone and a compromised server. Here is how to generate, store and move SSH keys safely on iOS.
If you are searching for SSH key management on iOS, you are probably doing one of two things: setting up key-based login for the first time instead of typing a password on a phone keyboard, or double-checking that keeping a private key on your phone is actually safe. Both are good instincts. Here is what actually matters.
Why a key beats a password
- No credential to leak. A password sent to a server can be guessed, brute forced or phished. A private key never leaves your device, only a signature proving you hold it does.
- Revocable per device. Lose your phone and you remove that one key from each server's authorized_keys file. Every other device keeps working.
- Nothing to type. Once a key is set up, logging in is a tap, not a password you retype on a phone keyboard every time.
ed25519 or RSA?
Two key types cover almost every server you will connect to. ed25519 is the modern default: shorter, faster to generate and verify, and considered at least as secure as RSA at any practical key size. RSA is older and universally supported, useful mainly if you are connecting to a server too old to recognize ed25519, which is now rare. Unless you have a specific reason to use RSA, generate ed25519.
Where the key should actually live
On iOS, that is the Keychain, not a file sitting in some app's sandbox. The Keychain is hardware encrypted and gated behind Face ID or Touch ID, so even if your phone is unlocked in someone else's hands, the private key itself is not readable without a second authentication step. Any app asking you to email yourself a key file, or store one in iCloud Drive as a plain .pem, is asking you to take on risk the Keychain exists to remove.
Generating a key vs importing one
Generating a key directly on your iPhone means the private key has never existed anywhere else, which is the cleanest security property you can get. Importing an existing key makes sense if you already use the same identity from a laptop and want continuity, but it means that key has existed outside the Keychain at some point, as a file you had to move. Where possible, treat each device as its own identity: generate a key per device, add each device's public key to the server separately, and you can revoke one without touching the others.
Getting the public key onto your server
Copy the public key, never the private one, and append it to ~/.ssh/authorized_keys on the server. The first connection will ask you to confirm the server's host key fingerprint. That is expected the first time and just means your app has not seen that specific server before. After that, connecting is immediate, with no password prompt.
Worth knowing before you rely on it
A key generated inside the Keychain deliberately cannot be exported as plain text. That is a security feature, not a bug, but it does mean you cannot copy that exact private key onto a second device the way you might with an old style key file. If you need the same key on your phone and your Mac, you either need an app that can move it across in encrypted form, or you accept a separate key per device, which is the safer habit anyway.
Our pick: Kestrel
We build Kestrel, an SSH and server manager for iPhone and Mac (Windows is coming soon). Its Key Manager generates, imports and exports both ed25519 and RSA keys, with everything backed by the iOS Keychain behind Face ID rather than a plain file. The free tier connects up to 3 servers with the full terminal and a basic dashboard, no account required to start; cloud sync across iPhone and Mac is a Pro feature, so your keys and servers follow you without manually moving a file between devices.
Manage your SSH keys properly
Generate, store and sync your keys without ever touching a plain file.
For more on getting set up from your phone, see our guides on how to SSH into a server from your iPhone, the best SSH client for iPhone, and how to manage your homelab from your phone.
Frequently asked questions
Is it safe to store SSH private keys on an iPhone?
Yes, as long as the key lives in the iOS Keychain rather than a plain file. The Keychain is hardware encrypted and gated behind Face ID or Touch ID.
Should I use ed25519 or RSA for a new SSH key?
Use ed25519 for any new key. It is shorter and faster, and at least as secure as RSA. RSA is mainly for servers too old to support ed25519.
Can I use the same SSH key on my phone and my laptop?
You can import one key into both, but a separate key per device is safer: losing one device means revoking only that key, not every device at once.