[Chapter 22] 22.4 Setting an Exact umask
Author: Jerry Peek, Tim O'Reilly & Mike Loukides
Date: 1998-08-04T21:40:25Z

#

| Chapter 22 File Security, Ownership, and Sharing |

## 22.4 Setting an Exact umask

You can use the umask command to set the default mode for newly created files. Its argument is a three-digit numeric mode that represents the access to be inhibited - masked out - when a file is created. Thus, the value it wants is the octal complement of the numeric file mode you want. To determine this, you simply figure out the numeric equivalent (1.23) for the file mode you want and then subtract it from 777. For example, to get the mode 751 by default, compute 777-751 = 026; this is the value you give to umask:

>     % umask 026

Once this command is executed, all future files created will be given this protection automatically. System administrators can put a umask command in the system initialization file to set a default for all users. You can set your own umask in your shell setup files (2.1). Article 22.2 has more information about the umask and two aliases for changing yours.

- AF from O'Reilly & Associates' Essential System Administration, Chapter 2

22.3 Who Will Own a New File? |  | 22.5 Group Permissions in a Directory with the setgid Bit