Page tree
Skip to end of metadata
Go to start of metadata

Setting umask

You can setup umask in /etc/bashrc or /etc/profile file for all users. By default most Linux distro set it to 0022 (022) or 0002 (002).

Users themselves can set their umask by creating in their home directory a custom profile file.

Calculating umask

Task: Calculating The Final Permission For FILES

You can simply subtract the umask from the base permissions to determine the final permission for file as follows:
666 - 022 = 644

  • File base permissions : 666
  • umask value : 022
  • subtract to get permissions of new file (666-022) : 644 (rw-r--r--)

Task: Calculating The Final Permission For DIRECTORIES

You can simply subtract the umask from the base permissions to determine the final permission for directory as follows:
777 - 022 = 755

  • Directory base permissions : 777
  • umask value : 022
  • Subtract to get permissions of new directory (777-022) : 755 (rwxr-xr-x)

References

This seems to talk about the acl and mask issue - http://bsdwiki.reedmedia.net/wiki/View_and_modify_ACLs.html

First Google hit - http://www.cyberciti.biz/tips/understanding-linux-unix-umask-value-usage.html

Says it has examples - http://linuxaria.com/article/linux-shell-understanding-umask-with-examples?lang=en