System Administration Guide: Basic Administration

Default File Permissions (umask)

When you create a file or directory, the default file permissions assigned to the file or directory are controlled by the user mask. The user mask is set by the umask command in a user initialization file. You can display the current value of the user mask by typing umask and pressing Return.

The user mask can be set with a three-digit octal value. The first digit sets permissions for the user; the second sets permissions for group; the third sets permissions for other (also referred to as “world”). Note that if the first digit is zero, it is not displayed. For example, if umask is set to 022, 22 is displayed.

To determine the umask value you want to set, subtract the value of the permissions you want from 666 (for a file) or 777 (for a directory). The remainder is the value to use with the umask command. For example, suppose you want to change the default mode for files to 644 (rw-r--r--). The difference between 666 and 644 is 022, which is the value you would use as an argument to the umask command.

You can also determine the umask value you want to set by using the following table, which shows the file and directory permissions that are created for each of the octal values of umask.

Table 4–22 Permissions for umask Values

umask Octal Value

File Permissions 

Directory Permissions 

0

rw-

rwx

1

rw-

rw-

2

r--

r-x

3

r--

r--

4

-w-

-wx

5

-w-

-w-

6

--x

--x

7

--- (none)

--- (none)

The following line in a user initialization file sets the default file permissions to rw-rw-rw-.


umask 000