Controlling File and Directory Permissions
57
Resulting
permissions
umask
6 6 6
0 2 2
6 4 4
New files
−
7 7 7
0 2 2
7 5 5
New directories
−
Linux base permissions
Figure 5-1: How a umask value of 022 affects the permissions
on new files and directories
For example, if the
umask
is
set to
022
, a new file with the original default
permissions of
666
will now have the permissions
644
, meaning the owner
has both
read and write permissions, and the group and all other users
have only read permission.
In Kali, as with most Debian systems, the
umask
is preconfigured to 022,
meaning the Kali default is 644 for files and 755 for directories.
The
umask
value is not universal to all users on the system. Each user
can
set a personal default
umask
value for the files and directories in their
personal
.profile file. To see the current value when logged on as the user,
simply enter the command
umask
and note what is returned.
To change the
umask
value for a user, edit the file
/home/username/.profile and, for example,
add
umask 007
to set it so only the user and members of the user’s
group have
permissions.