[opensuse] Wanna umask inhereted from parent directory
Hi all, Most of the time I administer Redhat server. However, recently I spend more and more time exploring Opensuse. There's one thing that I don't get it yet regarding sgid and umask in Opensuse. In RH, when I create a directory say 'test', chmod it 3770. It will look like this: drwxrws--T 2 root sales 4096 2007-05-23 08:16 test Then, when I create a file inside the directory, it will have permission like this: -rw-rw-r-- 1 geecko sales 4 2007-05-23 09:14 filegeecko (notice the rw-rw-r--). I do the same in Opensuse. But, the file created in the directory have the permission: -rw-r--r-- 1 geecko sales 4 2007-05-23 09:17 filegeecko (notice the rw-r--r--). This permission makes other user in sales group cannot edit geecko's file. User geecko has to specifically set the permission to 664 on the file. How do I achive the default umask inhereted from the parent directory? I read some suggestions from google to adjust the global default umask, but I think it's a bit risky, or is it the only way? Thank you very much. -- Fajar Priyanto | Reg'd Linux User #327841 | Linux tutorial http://linux2.arinet.org 9:32am up 1:25, 2.6.18.2-34-default GNU/Linux Let's use OpenOffice. http://www.openoffice.org
On Tuesday 22 May 2007 23:54, Fajar Priyanto wrote:
Hi all, Most of the time I administer Redhat server. However, recently I spend more and more time exploring Opensuse.
There's one thing that I don't get it yet regarding sgid and umask in Opensuse.
In RH, when I create a directory say 'test', chmod it 3770. It will look like this: drwxrws--T 2 root sales 4096 2007-05-23 08:16 test Then, when I create a file inside the directory, it will have permission like this: -rw-rw-r-- 1 geecko sales 4 2007-05-23 09:14 filegeecko (notice the rw-rw-r--).
I do the same in Opensuse. But, the file created in the directory have the permission: -rw-r--r-- 1 geecko sales 4 2007-05-23 09:17 filegeecko (notice the rw-r--r--). This permission makes other user in sales group cannot edit geecko's file. User geecko has to specifically set the permission to 664 on the file.
How do I achive the default umask inhereted from the parent directory? I read some suggestions from google to adjust the global default umask, but I think it's a bit risky, or is it the only way?
Thank you very much.
Hello Fajar, This is because the default umask for normal users in RH is 002 which is key to what they call the User Private Group Scheme. The default umask for normal users in opensuse seems to be 022 -- at least on my system. Check the /etc/bashrc file on the RH Server. In this file we have the following "if" construct: if [ "`id -gn`" = "`id -un`" -a `id -u` -gt 99 ]; then umask 002 else umask 022 fi This little test is what causes the umask thing in RH servers. This says that if the effective group name is equal to the username and the users effective id is greater than 99 then set the umask to 002. Otherwise set the umask to 022. Hope this helps, Phil -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Fajar Priyanto wrote:
Hi all, Most of the time I administer Redhat server. However, recently I spend more and more time exploring Opensuse.
There's one thing that I don't get it yet regarding sgid and umask in Opensuse.
In RH, when I create a directory say 'test', chmod it 3770. It will look like this: drwxrws--T 2 root sales 4096 2007-05-23 08:16 test Then, when I create a file inside the directory, it will have permission like this: -rw-rw-r-- 1 geecko sales 4 2007-05-23 09:14 filegeecko (notice the rw-rw-r--).
I just tried this on both RedHat 3 & 4 and don't see this. I think it just has to do with whatever your umask is for the user 'geecko'. This can be set in a bunch of different places, and usually has a default value assigned in a few places, but can always be changed by the user. In your case, your umask is 002, while in other places, like the default umask for openSUSE, it is 022. You can see what the umask is via the 'umask' command.
I do the same in Opensuse. But, the file created in the directory have the permission: -rw-r--r-- 1 geecko sales 4 2007-05-23 09:17 filegeecko (notice the rw-r--r--). This permission makes other user in sales group cannot edit geecko's file. User geecko has to specifically set the permission to 664 on the file.
How do I achive the default umask inhereted from the parent directory? I read some suggestions from google to adjust the global default umask, but I think it's a bit risky, or is it the only way?
This isn't possible under standard Linux usage. Files and the like don't inherit properties from directories, save in the special case you are doing here, which is setting the setguid bit on a directory, which means by default, files created are in the directory's group. You can set the default umask, but it can be overridden by a user. If you want user 'geecko' to create these group writable files, just change the umask in geecko's .bash_profile or .bashrc file: umask 0002 As mentioned, ACLs could probably fix this too, but those are necessarily enabled on every filesystem. -- Jonathan Arnold (mailto:jdarnold@buddydog.org) Daemon Dancing in the Dark, an Open OS weblog: http://freebsd.amazingdev.com/blog/ UNIX is user-friendly. It's just a bit picky about who its friends are. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
participants (3)
-
Fajar Priyanto
-
Jonathan Arnold
-
Phil Savoie