Umask questions

Soldato
Joined
7 Apr 2004
Posts
4,212
Hi,

Got a couple of questions about linux umask, I know that for full permissions on files the octal value is 666 and directories is 777, but what i don't understand is how to work out umask values given a permission string.

Say for example say I want new files to be created as rwx r-- r-- (744), How would i calculate the umask value for these permissions?

Secondly, does umask operate on a per directory basis or per user basis?

Thanks,

Jack
 
Thanks, but thats just the octal value of the permission string isnt it? Thats not really what im after, sorry if i worded the question badly.

http://en.wikipedia.org/wiki/Umask

So for example:

Assuming the umask has the value 174, any new file will be created with the permissions 602 and any new directory will have permissions 603 because:

666 AND NOT(174) = 602

So with a umask value of 174, you get an octal permission string of 602 for newly created files (rw- --- -w-)


I just dont understand how the logical bitwise maths works to get from 174 to 602 :confused:

Thanks again,

Jack
 
Last edited:
Back
Top Bottom