One question that perplexed me when I first learned UNIX (actually Solaris), was why, if I have a umask of 022, do new files I create get created with 644 permissions, not 755. 777 XOR 022 = 755, does it not? It turns out that the permissions of new files are determined by XORing your umask with 666, while the permissions of new directories are determined by XORing your umask with 777. So: $ umask 022 $ touch foo $ mkdir bar $ ls -l total 4096 -rw-r--r-- 1 jpyne jpyne 0 Dec 16 12:14 foo drwxr-xr-x 2 jpyne jpyne 4096 Dec 16 12:14 bar I wonder, what was the historical reason for making the default permissions of a new file 666 and a new directory 777? ~Jeff On Sunday, December 15, 2002 8:41 PM, J.Francois wrote: > A fully available file is like you have above: > > 7 7 7 == rwx rwx rwx > 111 111 111 > > a umask of 022, for example, means "take away access > permisions" like so: > > 7 7 7 111 111 111 > - 0 2 2 000 010 010 <--- Here is your umask > ======== =========== > 7 5 5 111 101 101 > rwx r-x r-x