![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| umask | falcon16 | SUN Solaris | 7 | 03-18-2009 11:47 PM |
| umask | praveen_b744 | UNIX for Dummies Questions & Answers | 1 | 07-27-2008 02:14 AM |
| help on umask | suvendu4urs | Linux | 6 | 04-11-2008 12:12 PM |
| Umask help | x96riley3 | AIX | 1 | 04-04-2006 03:56 PM |
| umask | rsh | UNIX for Dummies Questions & Answers | 2 | 12-14-2002 12:52 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
umask
Hi,
Please, let me know how the umask is working? As per my understanding is aprt from subtracting from 666/777, logical gate operation is performing. Ex: If I set uname 011, it gave the permission like 666 for file. Request you to explain which gate's operation performed. $uname 011 $uname 0011 $vi abc $ls -l abc -rw-rw-rw- 1 unixguy staff 29 Jan 26 14:03 abc Regards, Naga ![]() |
|
||||
|
Hi,
Sorry for the inconvenience, Once again with umask Please, let me know how the umask is working? As per my understanding is aprt from subtracting from 666/777, logical gate operation is performing. Ex: If I set uname 011, it gave the permission like 666 for file. Request you to explain which gate's operation performed. $umask 011 $umask 0011 $vi abc $ls -l abc -rw-rw-rw- 1 unixguy staff 29 Jan 26 14:03 abc May I know why it should give -rw-rw-rw- if i set 011? As well if i see 000 also differ, may I know how the kernel is behaving? Thanks, Naga ![]() |
|
||||
|
The umask describes what file-access bits to always eliminate when creating a file, where 1 is execute, 2 is write, and 4 is read. a umask of 777 will always remove all bits, 666 will remove read and write, 000 won't clear any bits at all, etc. A umask of 000 will usually result in rw-rw-rw just because what created the file never asked for the execute bit to be set in the first place; the umask will never give more bits than what the program asked for, just remove specific bits.
|
|
||||
|
umask explanation
I thought to post the information related to umask which i have read it from sites so that it might be helpful to someone who comes across this thread ...
$ umask 022 (this is the default value in my system) For files, the permission settings are 0666 and for directories it is 0777 Having known the umask value, try creating a directory and a file and check what the file settings are $ mkdir tempdir1 $ ls -l drwxr-xr-x 2 root root 4096 2009-06-29 10:42 tempdir1 $ touch tempfile1 $ ls -l drwxr-xr-x 2 root root 4096 2009-06-29 10:42 tempdir1 -rw-r--r-- 1 root root 0 2009-06-29 10:43 tempfile1 Change the umask and again create a directory and a file and check the file permission settings $ umask 027 $ umask 0027 $ mkdir tempdir2 $ ls -l total 12 drwxr-x--- 2 root root 4096 2009-06-29 10:40 tempdir2 $ touch tempfile2 $ ls -l drwxr-x--- 2 root root 4096 2009-06-29 10:40 tempdir2 -rw-r----- 1 root root 0 2009-06-29 10:40 tempfile2 Now, let us see how the file permission settings are calculated using boolean expression. For the directories, you need to take the 1's complement of the umask value and perform a logical AND operation with 0777. For e.g. consider the case where we have umask value of 027 - 0000 0000 0010 0111 1's complement of 027 - 1111 1101 1000 For directories perform logical AND operation with 0777 (0000 0111 0111 0111). So 1111 1101 1000 (1's complement of 027) 0111 0111 0111 (0777) ------------------- 0111 0101 0000 = 0750 For files, perfom logical AND operation with 0666 (0000 0110 0110 0110), so 1111 1101 1000 (1's complement of 027) 0110 0110 0110 (0666) ------------------- 0110 0100 0000 = 0640 |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|