chmod 400 — r--------

400 = r--------: read-only for the owner.

Updated

400
Octal
r--------
Symbolic
Safe
Security

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.

WhoDigitSymbolicPermissions
Owner (user)4r--read
Group0---no access
Others0---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.

Chmod calculatorToggle read, write and execute for owner, group and others to build any permission.
Open the calculator

Frequently asked questions

What does chmod 400 do?
It sets the permissions to r--------: the owner gets read, the group no access and others no access.
What is 400 in symbolic notation?
r--------, or chmod u=r,g=,o= as a symbolic chmod command.
Is chmod 400 safe?
Yes, 400 does not give write access to other users.