Previous | Table of Contents | Next |
DESCRIPTION
The internal umask command masks your normal file modes, basically allowing you to have a personally defined set of modes for all new files and directories you create. By using umask you can:
The normal default for a system is 022. This masks the write permission for the group users and all other users. The result of umask 022 on a new file is permissions of 755, which is displayed by ls -l as:
-rwxr-xr-x 1 mylogin ts 5 Jan 24 17:09 anewfile
COMMAND FORMAT
Following is the general format of the umask command.
umask [ nnn ]
Arguments
The following argument may be passed to the umask command.
nnn | The umask value is set to nnn. This value must be an octal number. It is subtracted from the standard mode of 777 column-by-column to define your new file creation mode. You may think of the umask as the modes being denied. |
If you do not specify a value, the current umask value is displayed. |
RELATED COMMANDS
The chmod command is used to change modes and define the available absolute modes that can be used with umask. Refer to Module 17.
APPLICATIONS
The umask command is usually used in the system's profile file or the user's own .profile. It provides a means of controlling what modes are set for all users as defaults. You may decide you want different default modes than are being used as a system default. If this is the situation, place a umask command in your .profile to set your umask each time you log in.
TYPICAL OPERATION
In this activity you use the umask command to set your default creation mode to 750. Begin at the shell prompt.
cj> ls -l newfile1 -rw-rw-rw- 1 mylogin ts 0 Jan 25 13:42 newfile1
cj> ls -l newfile -rw-r----- 1 mylogin ts 0 Jan 24 17:20 newfile
Previous | Table of Contents | Next |