|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
Hi, i'm having a problem with umask command.I set the .profile of user01 to have umask 002. When user01 creates a directory file using "mkdir" command, the permission of the directory file is rwx-rwx-rw, which correct, bcoz the umask 002. But the problem is, when user01 tried to create a file using "touch" command, the permission of the created file is -rw-rw-r--, which is not correct. Please help me solve this. Thanks in advance. |
|
#2
|
||||
|
||||
|
Quote:
This is incorrect. It should be: drwxrwxr-x because umask 002 will mask out the write bit. You mask out the execute bit with a umask of 001. BTW as a test, I did do it on my machine with umask of 002. The directory came out with drwxrwxr-x and a file I touched came out with -rw-rw-r-- as expected. OS: FreeBSD 4.10 and shell: tcsh.
__________________
Up the Irons What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home. "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest Down with Sharon Osbourne Puzzle of the Month solved by sizeablegrin, etienne141 and L7Sqr, superior C/C++ programmers of the month |
|
#3
|
|||
|
|||
|
sorry, there have been mistakes on my thread. the permission of the directory file which user01 created is drwxrwxr-x, and the touched file created is -rw-rw-r--, and this is my problem. i set the .profile of user01 with umask 002, so that the files created should have a permission of rwxrwxr-x, is this possible? thnx.
|
|
#4
|
||||
|
||||
|
No, it is not possible to do this. Don't feel bad about this, a lot of people don't know how umask really works. Basically, any command/application is free to create files with appropriate permissions. For example, compilers normally would create executable files with -rwxrwxrwx and mkdir sets the same permissions to directories that it creates. touch creates files with permissions -rw-rw-rw-. Same with text editors -- there's no need for such applications to set the execute bit, because the files that they produce are usually non-executable by default. All that umask does is turn off certain bits that are enabled by default by the application/command. The umask does NOT turn on bits that are set off by default, by the application. What this means is that since touch never sets the executable bit by default, it isn't going to get magically turned on by the umask.
Hope this all makes sense ![]() Last edited by Scorpions4ever : June 24th, 2004 at 11:10 PM. |
|
#5
|
|||
|
|||
|
Oh i see, tnx so much.
|
|
#6
|
|||
|
|||
|
yeah thanks. very detailed. Those small but ever so important little tidbits of information that come in extremely handy under certain circumstances....
-Steven __________________ No. No, not really, the only change is if you could go and put your face in some manure and follow along at a reasonable distance, that would be fine. –Edmund Black Adder |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > UNIX Help > umask problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|