Skip to content

chmod a+r

chmod a+r file adds read permission for all three classes (owner, group and others) and leaves write and execute unchanged; because it names a explicitly, the umask does not filter it.

Results on common starting modes

a+r versus +r

a+r always reaches all three classes. Plain +r is filtered by the umask: with umask 077 it only adds read for the owner, and with 027 it skips others. The GNU manual gives the same example for +w versus a+w. When you want a predictable result in a script, write the class.

Publishing a directory tree: a+rX

To let a web server or other users read a whole tree, directories also need execute so they can be entered. A capital X adds execute only to directories and to files that already have execute for someone, so a+rX makes everything readable and every directory traversable without marking data files as programs.

chmod a+r report.pdf
chmod -R a+rX /var/www/site/public
# every parent directory on the path needs execute too:
namei -l /var/www/site/public/index.html

Frequently asked questions

What does chmod a+r do?
It gives read permission to the owner, the group and everyone else, without changing write or execute.
Is chmod a+r the same as chmod 644?
Only when the file was 600 or 644 to begin with. a+r adds read and keeps other bits; 644 replaces the whole mode, removing any execute and group write.
Why can the web server still not read the file after a+r?
Every directory on the path needs execute for that user. Check with namei -l /full/path and add a+x (or a+X) on the directory that shows no x for others.

Last reviewed by Arielton Oberek.