What does chmod 600 mean? Private key permissions for SSH and secrets

By TechCompare · Updated · How we check

chmod 600 gives -rw------- in ls -l: the owner can read and write, while the group and others get no access. Use it for SSH keys and other secrets.

chmod 600 shows as -rw------- in an ls -l listing: only the owner can read and write the file. The group and everyone else get no access at all. This is a common default for SSH private keys. Mode 400 is also valid when the owner only needs read access. OpenSSH rejects user-owned private keys accessible by group or others.

Octal
600
chmod 600
Symbolic
rw-------
Owner / Group / Others
Category
Secure Permissions
Restricted access

How this is calculated

In octal, 6 = 4+2+0 (read+write) for the owner, and the zeroes for group and others mean no permissions whatsoever. 600 is the usual mode for anything containing secrets: SSH keys, GPG private keys, database credential files, API token files. The principle is least privilege. Many applications will warn or refuse to run if their config files are world-readable and contain passwords.

Verdict

Use 600 for SSH keys and any other file that only its owner should touch. The octal sets the owner bits to 6 (4+2, read+write) and zeroes out group and others. Mode 400 is stricter.

SSH enforces restrictive permissions on private keys because a key readable by group or others could be copied by another account. The same principle applies to other credential stores: .env files with API tokens, AWS credentials under ~/.aws/, kubeconfig under ~/.kube/, and GPG secret keys.

Choose the narrowest mode that still lets the application work.

More CHMOD scenarios

Frequently asked questions

Why does SSH reject my key with 'permissions are too open'?
Because group or others can read the key file. SSH accepts mode 600 (owner read+write) or 400 (owner read only), and owner write access isn't required. A readable key is refused because anyone could have copied it.
How do I fix 'Bad permissions' on my SSH private key?
Run chmod 600 ~/.ssh/id_rsa (or whichever key filename). SSH enforces that private keys must not be readable by group or others when the file is owned by the invoking user. If your key mode is 644 (readable by all) or 666, SSH refuses to use it. Ownership and filesystem access still need to be correct, but a different owner is not the same permission check as group or other read access.
What other secret files should be chmod 600?
Any file containing credentials: .env files with API tokens or database passwords, GPG private keys (~/.gnupg/*.gpg), AWS credentials (~/.aws/credentials), kubeconfig files (~/.kube/config), and .htpasswd files. The principle is least privilege: if only one user or process needs access, restrict the file to that user with mode 600.