|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
||||
|
||||
|
Umask
It's hard to find a good umask specific resource. I don't what section of the man the umask usage falls under. I'm trying to set a directory so that files are automatically created with 775 permissions.
I have three questions. What is the umask code I would use to have the files auto-set to 775? Does anyone know a good website that explains how to use umask? What section of the man (on FreeBSD) can I find the umask usage documentation. Thanks |
|
#2
|
||||
|
||||
|
man -k umask
This gives a pointer to man umask. The man 1 umask page then says to consult the man pages for sh or csh for specifics. man csh has the info you're looking for. I did this all on FreeBSD 4.6-RELEASE To save you a bit of a read, basically umask is used to unmask certain bits. I assume you know how to use the chmod command. Well, the umask is used to unmask certain bits by default. In your case, you need to unmask the write bit for world. So, you would set umask to 002. Basically, this will unmask bit 2 for world alone (i.e. write permissions) and leave the user and group bits untouched since they're both 0. HTH ![]()
__________________
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
|
||||
|
||||
|
Thanks for the tip. Unfortunately files under a umask 002 are created with rw-rw-r-- settings, which is strange considering what the man says.
"002, giving all access to the group and read and execute access to others" That seems to fit the description of what I want really well so I don't know what to tell you. |
|
#4
|
||||
|
||||
|
It also depends on the app that is being used to create the file. For example, vi doesn't set a file as executable (only sets the read and write bits). So if you edit a file with vi, it will try to set 666 for permissions. Since your umask is 002, the effective permissions will be set to 664.
Now, by contrast, if you try to use gcc to compile a file, it sets the execute bits of the executable file that it created. gcc tries to set the executable's permissions to 777, so if you have umask of 002, the effective permissions will be set to 775. To demonstrate: Code:
# umask 002 # gcc -o file file.c # ls -l file -rwxrwxr-x 1 root wheel 5220 Jul 18 18:01 file # umask 022 # gcc -o file file.c # ls -l file -rwxr-xr-x 1 root wheel 5220 Jul 18 18:01 file So, if an app doesn't set a permission by default, your umask is not going to affect it. |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > UNIX Help > Umask |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|