Go to main content

Managing User Accounts and User Environments in Oracle® Solaris 11.4

Exit Print View

Updated: April 2019
 
 

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 contains the following octal values:

  • The first digit sets permissions for the user

  • The second digit sets permissions for group

  • The third digit sets permissions for other, also referred to as world

To determine the umask value that 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. Suppose that 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.

The following table provides umask values. It shows the file and directory permissions that are created for each of the octal values of umask.

Table 5  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