umask

When a file is created, it is possible to give permissions by default.

The command umask display the default permissions.

It returns the permissions that are substracted to a file from an "all permission" value:

  • a file is rw-rw-rw

  • a directory is rwxrwxrwx (x means that one can enter the directory for browsing)

For example, if umask is 022 (which corresponds to -ww), any file will be created with a default rw-r--r-- permission, while any directory will be made with rwxr-xr-x permissions.

To prevent any user other than the owner to browse a directory or read a file, umask must be set to 077.