What does chmod 400 mean?
chmod 400 gives read-only for the owner. Only the owner can read the file; nobody can change it. This is exactly what SSH requires for private keys (~/.ssh/id_ed25519) and what AWS asks for with downloaded .pem key pairs — OpenSSH refuses keys that others can read.
| Who | Digit | Symbolic | Permissions |
|---|---|---|---|
| Owner (user) | 4 | r-- | read |
| Group | 0 | --- | no access |
| Others | 0 | --- | no access |
Each digit is the sum of read (4), write (2) and execute (1). In ls -l the file shows as -r--------.
How to use chmod 400
# one file or directory
chmod 400 filename
# the same permissions in symbolic form
chmod u=r,g=,o= filename
# a directory and everything inside it
chmod -R 400 directory/
# only regular files
find path/ -type f -exec chmod 400 {} +
Need a different combination? Tick the boxes in the chmod calculator to get the octal and symbolic values instantly.
Pertanyaan yang sering diajukan
What does chmod 400 do?
What is 400 in symbolic notation?
r--------, or chmod u=r,g=,o= as a symbolic chmod command.