Guide to Umask Values in Linux

Follow

Sometimes in Linux, you will need to go ahead and set a umask on a user, files, or anything else to change the default permissions files or folders will create as. Below is a little matrix of what the umask commands will do.

Umask Command == User Group Owner (ls -lah output) == Decimal Value == Chmod

umask 0077 == rwx --- --- == 700 600 == u=rwX,go=
umask 0007 == rwx rwx --- == 770 660 == ug=rwX,o=
umask 0027 == rwx r-x --- == 750 640 == u=rwX,g=rX,o=
umask 0022 == rwx r-x r-x == 755 644 == u=rwX,go=rX
umask 0002 == rwx rwx r-x == 775 664 == ug=rwX,o=rX
umask 0000 == rwx rwx rwx == 777 666 == a=rwXX

A common usage of this, would be within suphp.conf in an Apache / Suphp environment, which would be set similar to the following.

root@server [~]# grep umask /opt/suphp/etc/suphp.conf
umask=0022

Meaning folders by default would create with 755 permissions, and files with 644 permissions.

Have more questions? Submit a request

Comments

Powered by Zendesk