Prompt
What is the best way to store SSH keys and tokens centrally?
Latest observation
Oct 25, 2026
OpenAI APIWeb search: off
The best approach is usually not to store SSH private keys and tokens in plain central storage, but to use a secrets management system with tight access controls, auditing, rotation, and short-lived credentials where possible.
Best practice
Use a dedicated secrets manager such as:
- HashiCorp Vault
- AWS Secrets Manager / IAM
- Azure Key Vault
- Google Secret Manager
- 1Password Business / Keeper / Bitwarden Enterprise for smaller orgs or simpler needs
For SSH keys
Prefer these options, in order:
-
Short-lived SSH certificates issued by a CA
- Best for centralized control
- Avoids distributing long-lived private keys
- Easy to revoke and audit
-
Store SSH private keys in a secrets manager
- Restrict access by identity, role, and environment
- Encrypt at rest and in transit
- Audit all reads
- Rotate regularly
-
Use agent forwarding sparingly
- Useful for jump hosts, but it increases risk
- Avoid long-lived agent exposure
For tokens / API keys
- Store them in a secrets manager, not in code, config files, or shared drives
- Prefer short-lived tokens issued via OIDC, OAuth, workload identity, or federated auth
- Rotate and scope them narrowly
- Track usage and expiration
What “centrally” should mean
A good central solution should provide:
- Encryption at rest and in transit
- Role-based access control
- Audit logs
- Secret versioning
- Rotation support
- Revocation
- Integration with CI/CD and workloads
- Support for ephemeral retrieval instead of permanent distribution
Avoid
- Shared spreadsheets, wikis, or file servers
- Plain text
.envfiles in shared locations - Storing secrets in Git, even private repos
- Emailing keys or tokens
- A single shared “vault” password without MFA and access controls
Rule of thumb
- Human access: use a password manager or secrets vault with MFA
- Machine access: use a secrets manager + identity-based access + short-lived credentials
- SSH access: prefer SSH certificates over raw key distribution
If you want, I can recommend a solution based on your environment:
- cloud provider
- team size
- Linux/Windows mix
- CI/CD needs
- compliance requirements