[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: why umask can't set "x" in file creation



On Wed, 22 Jun 2005, jim martin wrote:

Hi.. why my umask setting can't get the "x" in the file created permission

[root w2]# umask 0022
[root w2]# touch xxx
[root w2]# ls -l
total 20
-rw-r--r--  1 root root    0 Jun 23 02:32 xxx

[root w2]# umask u=rwx,g=rwx,o=rx
[root w2]# touch yy
[root w2 ]# ls -l
total 24
-rw-r--r--  1 root root    0 Jun 23 02:32 xxx
-rw-rw-r--  1 root root    0 Jun 23 02:34 yy

You've misinterpreted what umask does. It doesn't 'set' permissions - it 'masks' them. IOW it _subtracts_ default permissions. If a program doesn't _request_ the permission at file creation (touch doesn't request execute permission), a permissive umask won't force it be set. If you want execute permissions after creating a file with 'touch' you need to 'chmod +x' it afterwards.


--
Jerry

Simple things should be simple, complex things should be possible.
                                         - Alan Kay


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]