chmod 400 (r--------)

chmod 400 gives the owner read permission, the group none, and everyone else none. Read-only for the owner, e.g. AWS .pem key files.

400Octal
-r--------ls -l (file)
u=r,g=,o=Symbolic chmod

Change bits in the chmod calculator →

Breakdown

ClassDigitSymbolicReadWriteExecute
Owner (u)4r--✔——
Group (g)0---———
Others (o)0---———

owner 4 = 4 · group 0 = 0 · others 0 = 0

Commands

chmod 400 file.txt
chmod u=r,g=,o= file.txt     # same thing, symbolic
chmod -R 400 folder/        # recursive (careful: applies to files and directories)
find folder -type f -exec chmod 400 {} +   # only files

Applied to a directory

Things to know

Related modes

Frequently asked questions

What does chmod 400 mean?
Owner: r--, group: ---, others: ---. In ls -l output a file with this mode shows -r--------.
How do I set 400 with umask?
New files start from 666 and directories from 777, minus the umask. For new directories, umask 377 yields 400. For new files, umask 266 yields 400.