chmod 640 (rw-r-----)

chmod 640 gives the owner read, write permissions, the group read, and everyone else none. Config or log files readable by a service group, e.g. /etc/shadow uses 640 or 000.

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

Change bits in the chmod calculator →

Breakdown

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

owner 6 = 4 + 2 · group 4 = 4 · others 0 = 0

Commands

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

Applied to a directory

Things to know

Related modes

Frequently asked questions

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