The umask setting plays a big role in determining the permissions that are assigned to files that you create. But what’s behind this variable and how do the numbers relate to settings like rwxr-xr-x?
First, umask is a setting that directly controls the permissions assigned when you create files or directories. Create a new file using a text editor or simply with the touch command and its permissions will be derived from your umask setting. You can look at your umask setting simply by typing umask on the command line.
$ umask 0022
Where the umask setting comes from
The umask setting for all users is generally set up in a system-wide file like /etc/profile, /etc/bashrc or /etc/login.defs — a file that’s used every time someone logs into the system. The setting can be overidden in user-specific files like ~/.bashrc or ~/.profile since these files are read later in the login process. It can also be reset on a temporary basis at any time with the umask command.
From: Network World