On Tue, 2005-04-26 at 19:37 +0200, Erik Jakobsen wrote:
Ken Schneider wrote:
Trying to remember from a failing memory...
umask is the invert of the permissions you want to set. On files a umask of 000 would create files with 666 perms. With 022 it would be 644 and with 044 it would be 622 and last 066 would result in perms of 600.
octal 666 = -rw-rw-rw 644 = -rw-r--r- 622 = -rw--w--w (useless as write permission infers read permission) 600 = -rw------
Hi Ken. If I say that I understand it its not the true. Maybe first of all because I'm still not quite sure on what umask does, but will read what Randall wrote to me.
How can for instance 000 be equal to 666 ?. Not that I say, that I doubt what You tell me, but I myself am not sure on how ?.
umask actually subtracts from what would be full access. full access = 666 on files, 777 on dirs. (owner,group,world) umask 022 = 644, subtracting 2 from the second and last bits. Keep in mind that the numbers are octal base 8. There are many more that can be used when you consider that executable files need the execute bit set which would mean full access = 777/rwxrwxrwx. It can be confusing but once you understand the bits it will look easy. octal codes for files are: rwx = 7 - 4 for read, 2 for write and 1 for execute rw- = 6 - 4 for read, 2 for write with no execution r-- = 4 - 4 for read only octal codes for directories are: rwx = 7 - as above except the execute bit gives access to the directory r-x = 5 - 4 for reading the directory file, that is the . file to list the contents and 1 for directory access. If you don't have access to the directory you can not list its contents even with read access. There is one other bit called the sticky bit, but we will reserve that for another lesson. Create some files and dirs and change the mode on them to get a feel for what the bits do. -- Ken Schneider UNIX since 1989, linux since 1994, SuSE since 1998 "The day Microsoft makes something that doesn't suck is probably the day they start making vacuum cleaners." -Ernst Jan Plugge