How to Encrypt Your AWS Credentials, SSH Keys, and API Tokens
A hands-on guide to encrypting and syncing the three most commonly leaked credential types across your development machines.
The Three Credentials That Leak Most Often
AWS access keys, SSH private keys, and API tokens (npm, Docker, GitHub) are the three credential types most frequently found in public repositories and data breaches. They share a common trait: they live in dotfiles on developer machines, and developers need them on every machine they work on.
This guide walks through encrypting and syncing each one with ConfigSync. By the end, you will have a single workflow that keeps all three credential types encrypted at rest, encrypted in transit, and available on every machine you use.
AWS Credentials
AWS credentials live in two files: ~/.aws/config (region and profile settings) and ~/.aws/credentials (access keys and secret keys). The config file is generally safe to leave unencrypted — it contains region names and output format preferences. The credentials file contains the keys that grant access to your AWS account.
After pushing, both files are AES-256-GCM encrypted in ConfigSync's vault. On a new machine, pulling restores them with 0600 permissions. Your AWS CLI, SDKs, and tools like Terraform pick them up automatically from the standard path.
SSH Keys
The SSH module auto-detects all key pairs in ~/.ssh by scanning for id_* files. Private keys are encrypted; public keys are synced in plaintext since they are designed to be shared. The SSH config and known_hosts files are also included.
ConfigSync restores private keys with 0600 permissions, which OpenSSH requires. Without correct permissions, SSH refuses to use the key. ConfigSync handles this automatically so keys work immediately after pulling.
id_* pattern and classifies each as public or private based on the file content.npm and Docker Tokens
npm stores authentication tokens in ~/.npmrc, used for publishing packages and accessing private registries. Docker stores credentials in ~/.docker/config.json, used for pulling and pushing images to private registries. Both are frequently committed to dotfile repos by mistake.
Both files are encrypted with AES-256-GCM before upload. On a new machine, pulling restores them so npm install and docker pull work immediately with your private registries.
GPG Keys
GPG keys are used for signing git commits, encrypting files, and authenticating with some package managers. The GPG module tracks your configuration and agent settings.
The Complete Workflow
Here is how to add all credential modules, push, verify, and pull on a new machine — the entire setup takes under two minutes:
File Permissions: The Detail That Matters
Credential files require strict permissions. If ~/.ssh/id_ed25519 is readable by other users, SSH refuses to use it. If ~/.aws/credentials is world-readable, any process on the machine can harvest your keys. ConfigSync restores all sensitive files with 0600 permissions (owner read/write only).
| File | Permissions | Encrypted | Reason |
|---|---|---|---|
| ~/.aws/credentials | 0600 | Yes | Contains secret access keys |
| ~/.aws/config | 0600 | Yes | May contain account IDs, SSO URLs |
| ~/.ssh/id_ed25519 | 0600 | Yes | SSH private key |
| ~/.ssh/id_ed25519.pub | 0644 | No | Public key (safe to share) |
| ~/.ssh/config | 0600 | Yes | May contain hostnames, users |
| ~/.ssh/known_hosts | 0644 | No | Server fingerprints (not secret) |
| ~/.npmrc | 0600 | Yes | Contains auth tokens |
| ~/.docker/config.json | 0600 | Yes | Contains registry credentials |
| ~/.gnupg/gpg.conf | 0600 | Yes | GPG configuration |
You do not need to remember or configure these permissions. ConfigSync applies them automatically based on the file type and module. Every pull restores the correct permissions so your tools work without manual fixes.
Stop Leaving Credentials Unprotected
AWS keys, SSH keys, and API tokens are the most valuable files on your development machine. They grant access to cloud infrastructure, source code repositories, package registries, and production systems. Leaving them unencrypted in dotfile repos, cloud drives, or scattered across machines is a liability.
Ready to try ConfigSync?
Sync your entire dev environment across machines in minutes. Free forever for up to 3 devices.