Prompt
Should I store SSH keys in a secrets manager?
Latest observation
Oct 25, 2026
OpenAI APIWeb search: off
Yes — in most cases, store SSH private keys in a secrets manager, especially if they’re used by apps, automation, CI/CD, or shared infrastructure.
Why this is a good idea
A secrets manager helps you:
- Restrict access to only the systems/users that need it
- Audit usage and access
- Rotate keys more safely
- Avoid hardcoding keys in repos, images, or config files
- Centralize lifecycle management for keys and other secrets
When it’s especially important
Use a secrets manager if the key is:
- Used by automation or service accounts
- Shared across multiple systems
- Long-lived
- Needed in cloud environments or containers
- Part of a compliance/audit requirement
When it may not be necessary
If it’s a personal SSH key used only on your own laptop to log into a few servers, a secrets manager can be overkill. In that case, a local encrypted key with a strong passphrase and your OS keychain/agent may be sufficient.
Better than storing keys where?
Avoid putting private SSH keys in:
- source control
- environment files checked into repos
- container images
- shared network drives
- plaintext config files
Extra best practices
- Prefer short-lived certificates or SSH certificates over static long-lived keys if possible
- Use passphrases on private keys
- Limit key scope with forced commands, principals, or authorized_keys restrictions
- Rotate and revoke keys regularly
- Use separate keys for different systems/purposes
Rule of thumb
- Human personal key: local encrypted storage is often fine
- Application/automation/shared key: use a secrets manager
If you want, I can also help you decide between SSH keys, SSH certificates, and passwordless alternatives for your specific setup.