LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Security (https://www.linuxquestions.org/questions/linux-security-4/)
-   -   set default umask to a directory or a group (https://www.linuxquestions.org/questions/linux-security-4/set-default-umask-to-a-directory-or-a-group-755766/)

luvlinux2009 09-16-2009 08:06 PM

set default umask to a directory or a group
 
Hi all,

Does anyone know how to set a default umask to a directory or to a group?
It seems you can only set the umask to a user.
I need to set the umask to a particular folder or group would work as well. The umask will be 002.

chrism01 09-16-2009 08:41 PM

I don't think so...
What are you trying to achieve?
If you want a shared dir, use: chmod g+s dirname
http://ss64.com/bash/chmod.html

luvlinux2009 09-17-2009 12:52 PM

I'm using g+s already. This sets the defined group ownership to any files/directories created under the parent directory where the g+s was set and works perfectly.

However as for the directory/file permissions, sub directores/files created under the parent do not get the same permissions as the root directory.
I need all the directories to be 775 and files 664 as I need all the members of this particular group to have full permissions to all the files/directories created (no matter who creates it as long as they're in the same group) under the parent directory.
If I could apply the umask of 002 to the group, this would work perfectly.

I guess I can create a cron job to run chmod -R g+w directoryname that will do this but I'd like for this to happen on the fly.

grepmasterd 09-17-2009 01:29 PM

I've seen this requested many times and I've never seen anyone post a solution. I believe it falls in the "can't be done" category. Under linux, users have full control over the files they own, not the filesystem. That's the model.

Whatever you implement will have to be an indirect modification, ie your cron job or some daemon running in the background. it can't be done inherently, afaik.

chrism01 09-17-2009 08:54 PM

The soln (I think) in that case would be create a 'user' same name as the group and make the groupuser the owner of the dir. You can then apply the mask to user groupuser. Not sure if that'll work though. Let us know what happens.


All times are GMT -5. The time now is 03:02 AM.