SSH Keygen Command Builder
Configure your SSH key options and get the exact ssh-keygen command to run.
Nothing is generated on this page — the command runs locally in your terminal.
100% client-side · no keys generated here
Command to run in your terminal
Next steps after generating the key
- Run the command above in your terminal.
- Copy your public key:
cat ~/.ssh/id_ed25519.pub - Add it to the target server:
ssh-copy-id user@server - Test the connection:
ssh -i ~/.ssh/id_ed25519 user@server - Add to ssh-agent for passphrase caching:
ssh-add ~/.ssh/id_ed25519
Common use cases
- GitHub / GitLab: Generate Ed25519 key, add public key in Settings → SSH Keys.
- Server access: Generate RSA 4096 for legacy servers, Ed25519 for modern ones.
- CI/CD: Generate a key without passphrase (-N "") for automated deployments, restricted to specific commands via forced commands in authorized_keys.
- Multiple identities: Use -f to save to a named path, then configure ~/.ssh/config with Host blocks to select the right key per host.
Related tools: SSL Cert Decoder · Port Reference · Password Generator · All DevOps Tools
常見問題
- Which SSH key type should I use?
- Ed25519 is the modern default. It is faster than RSA, produces smaller keys (68 chars vs 740+ for RSA 4096), and is supported by all modern SSH servers and clients. Use RSA 4096 only when connecting to legacy servers that do not support Ed25519.
- What bits size should I choose for RSA?
- Use RSA 4096 as a minimum today. RSA 2048 is still technically adequate but 4096 adds marginal cost for significant future-proofing. RSA 1024 is broken and must not be used.
- Should I set a passphrase?
- Yes, always. A passphrase encrypts the private key file using AES-256. Without it, anyone who gains access to your ~/.ssh/id_ed25519 file can use it immediately. Use ssh-agent or macOS Keychain to avoid retyping the passphrase on every connection.
- What is the -C flag (comment)?
- The comment is a label appended to the public key. It is visible in authorized_keys files and host logs. Use your email address or a descriptive label (e.g. alice@laptop-2024) to identify which key is which when managing multiple devices.
- Where should I store the generated key?
- By default, ssh-keygen saves to ~/.ssh/id_ed25519 (private) and ~/.ssh/id_ed25519.pub (public). Use the -f flag to save to a custom path — useful for per-project or per-service keys.
- How do I add my public key to a server?
- Run: ssh-copy-id user@server — this appends your public key to ~/.ssh/authorized_keys on the server. Or manually append the contents of your .pub file to ~/.ssh/authorized_keys on the target machine.
- What is the difference between RSA and ECDSA?
- ECDSA (Elliptic Curve DSA) produces small keys similar to Ed25519 but uses the NIST P-256 or P-384 curves, which some security researchers consider potentially backdoored. Ed25519 uses Curve25519 which has no such concerns and is the preferred elliptic-curve option.
- How do I convert an existing RSA key to Ed25519?
- You cannot convert key types. Generate a new Ed25519 key pair, add the new public key to authorized_keys on all servers, verify you can log in with the new key, then remove the old RSA key from authorized_keys.