Default Permissions for File Creation

Default Permissions for File Creation

When a file or directory is created, its initial permissions are determined by a setting called umask . A umask is a value similar to an absolute mode that is subtracted from full permissions to determine the permissions. A typical umask would be 022 or 002. Chapter 7, "Configuring Your Environment with Unix," explains how to see, and change, your umask . You may see umask s displayed as one- or two-digit numbers ; in those cases, assume that zeros are added to the left, so a umask of 2 is really 002.

"Full permissions" for files are considered to be 666 (readable and writable by everyone) and for directories to be 777 (readable, writable, and executable by everyone). You always have to explicitly change a file's permission to make a non-directory file (such as a script) executable.

The net result is that if you have a umask of 022, for example, and create a new directory, the permission on the directory is 755 (777 022), and if you create a new file, the permission is 644 (666 022).

Table 8.8 shows the effect of various umask s on the creation of new files and directories.

Table 8.8. Effect of umask on New File Permissions





644 ( rw-r--r-- )

755 ( rwxr-xr-x )


664 ( rw--rwr-- )

775 ( rwxrwxr-x )


600 ( rw------- )

700 ( rwx------ )


622 ( rw------- )

733 ( rwx--x--x )

Unix for Mac OS X 10. 4 Tiger. Visual QuickPro Guide
Unix for Mac OS X 10.4 Tiger: Visual QuickPro Guide (2nd Edition)
ISBN: 0321246683
EAN: 2147483647
Year: 2004
Pages: 161
Authors: Matisse Enzer

Similar book on Amazon © 2008-2017.
If you may any questions please contact us: