## 49.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 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 to override defaults.

-- AF

Copyright © 2003 O'Reilly & Associates. All rights reserved.