Title: umask
Course: CIS 121: Linux/UNIX I: Fundamentals ~ For IGNITE Review > Section: Learning Modules

Umask

The umask command sets up a masking sequence to control the permissions of new files. It masks (blocks) certain bits.

- The command by itself will report the current mask setting.
- The command followed by an octal number sequence will set the mask.

When creating a file or directory, a set of default permissions are applied. These default permissions are determined by the umask. The umask specifies permissions that you do not want set on by default. You can display the umask with the umask command.

[Harry@RHEL4b ~]$ umask

0002

[Harry@RHEL4b ~]$ touch test

[Harry@RHEL4b ~]$ ls -l test

-rw-rw-r-- 1 Harry Harry 0 Jul 24 06:03 test

[Harry@RHEL4b ~]$

As you can also see, the file is also not executable by default. This is a general security feature among Unix. Newly created files are never executable by default. You have to explicitly do a chmod +x to make a file executable.

(Source: Linux Fundamentals, Cobbaut, 221)