Home > How-Tos > umask

umask

August 21st, 2009

umask determines what permissions any new files or directories will have by default. Like file permissions, it historically takes an octal value (e.g. ‘umask 002′), but can also symbolic values (e.g. ‘umask a=rx,ug+w’). I’m going to just focus on the octal values.

The octal value appears to have a lower than what you’d normally set with chmod, but this is because it is actually subtracted from the maximum possible file (666) or directory (777) permissions.

For example if you create a new directory with umask set to 022, the resulting permissions are set to 755, since 777 – 022 = 755.

Most of the time umask is set sensibly from the beginning, and you don’t have to worry about it. If you do need to change it, you’ll probably find it being set in one of your login scripts – ‘/etc/profile’ or ‘~/.bashrc’.

For more information just check the man page.

Categories: How-Tos Tags: , ,
Comments are closed.