chmod 504 (r-x---r--)

chmod 504 gives the owner read, execute permissions, the group none, and everyone else read.

504Octal
-r-x---r--ls -l (file)
u=rx,g=,o=rSymbolic chmod

Change bits in the chmod calculator →

Breakdown

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

owner 5 = 4 + 1 · group 0 = 0 · others 4 = 4

Commands

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

Applied to a directory

Things to know

Related modes

Frequently asked questions

What does chmod 504 mean?
Owner: r-x, group: ---, others: r--. In ls -l output a file with this mode shows -r-x---r--.
How do I set 504 with umask?
New files start from 666 and directories from 777, minus the umask. For new directories, umask 273 yields 504. New files never get execute bits from umask alone, so add them with chmod.