Controlling File Permissions Using UMASK

Permissions for files you create are set via umask. If you are used to using chmod to change permissions the numbering sheme for umask might seem odd

To find out what your current umask is set to in a terminal type umask


UMASK settings for all users is set in the /etc/profile file. Any umask set there will globally set every users umask on that system. To set your own enter your umask in ~/.profile


Use the following table as a guide. You add up the values you want and use that number to set permissions...examples after table


0RWX
1RW-
2R-X
3R--
4-WX
5-W-
6--X
7---


A umask of 022 will set the file permissions as rwxr-xr-x (user has rwx group has rx and other has rx)


A umask of 077 will set the file permissions as rwx------ (user has rwx group has no permissions and other has no permissions....a very security consious umask)


A umask of 007 will set the file permissions as rwxrwx--- (user has rwx group has rwx and other has no permissions)


A umask of 027 will set the file permissions as rwxr-x--- (user has rwx group has r-x and other has no permissions)