chmod 400 — what r-------- means

400 r--------

The owner can read only; nobody can write or execute, and group and others get nothing.

Permission breakdown

When to use 400

Common mistakes & gotchas

400 vs the alternatives

Set it with chmod

Apply this permission to a single file:

chmod 400 filename

Or apply it recursively to a directory and everything inside it:

chmod -R 400 directory/

The same thing in symbolic form:

chmod u=r,g=,o= filename

Frequently asked questions

What does chmod 400 mean?

chmod 400 sets permissions to r--------: only the owner can read the file, and no one can write or execute it. Group and others get no access at all. It is the standard for private, read-only secrets like SSH keys.

Why does SSH require my private key to be 400 or 600?

SSH refuses keys that are readable by group or others to prevent credential theft on shared systems. 400 (owner read-only) or 600 (owner read-write) limits access to you alone, satisfying SSH's permission check.

How do I update a file that is set to 400?

Restore write first with chmod u+w file (or chmod 600 file), make your change, then set it back with chmod 400 file. The owner can always change the mode even though write is off.

What is the difference between 400 and 600?

Both restrict access to the owner alone. 600 lets the owner read and write; 400 removes write, making the secret read-only even to its owner — useful when you want to prevent accidental modification of a key or credential.

Other common permissions

Or build any permission with the interactive chmod calculator.