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.
- from O'Reilly & Associates' Essential System Administration , Chapter 2