chmod 600: what it means and when to use it
chmod 600 lets the owner read and write the file and gives nobody else any access to it.
600
rw-------
| Who | Digit | Read | Write | Execute |
|---|---|---|---|---|
| Owner | 6 |
Yes | Yes | No |
| Group | 0 |
No | No | No |
| Everyone else | 0 |
No | No | No |
How chmod 600 works
The 6 is read (4) plus write (2) for the owner, while the zeros completely close off the group and all other users. There is no execute permission, which is ideal for data files.
In symbolic format, chmod 600 is represented as <code>rw-------</code>. Only the file owner can open or modify it, and no one else can even read a single line.
600 is the industry standard for secrets and credentials. SSH private keys (such as <code>id_rsa</code>) must be 600 or SSH will refuse to connect. The same rule applies to <code>.env</code> files, database configuration files, and API token storage.
Where 600 belongs
- SSH private keys (id_rsa, id_ed25519)
- .env files and local secret configs
- Database passwords and API token files on shared hosts
The command
Both of these set exactly the same permissions. The number is shorter; the letters are easier to read back later.
chmod 600 filename
chmod u=rw,g=,o= filename
If an automated service needs to read the file, assign that service's user as the owner with chown rather than opening the file to 644.