LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Red Hat (http://www.linuxquestions.org/questions/red-hat-31/)
-   -   can we set muliple SGID only for single directory ? (http://www.linuxquestions.org/questions/red-hat-31/can-we-set-muliple-sgid-only-for-single-directory-4175427220/)

crazy_linux 09-14-2012 06:41 AM

can we set muliple SGID only for single directory ?
 
Hello All,

Thanks for viewing my posts. I am beginner to Linux World. Thanks for those people who are trying to answer my questions.

My question is that suppose say that as an root I have created a directory called opensource under /

so now this /opensource directory has 755 permissions (Default)

Now suppose say I have two groups created as Sales and Finance.

2 users say tom and harry are the part of secondary group Sales

2 users say ram and laxman are the part of secondary group Finance

Now my question is I would like to have SGID set on this /opensource directory in such a way that whenever the user tom or harry creates files in /opensource directory the group owner of the file should reflect with Sales.

Whenever ram and laxman creates the files in /opensource directory the group owner of the files should reflect with Finance.


Is this possible to set with the commands or do we need any scripts ?

zhjim 09-14-2012 06:49 AM

I guess you would need a script. But there might be the chance that you can go with ACL. setfacl and getfacl are the binaries for it.
You sure would need the sgid settings. The sgid access right makes every file owned by the group of the parent folder. But i don't know if this is valid within ACL. Just try and see.

nijinashok00 09-29-2012 01:37 PM

We cannot make two group owners for a directory. Sgid makes group owner of all newly created files and directories within the parent directory as the parent directory group owner. Since we cannot make two group owners for a directory we can't make Sgid with two group.

techguru666 09-30-2012 11:58 AM

With normal permissions, and even with SGID bit, it is not possible. You can set permissions on two different groups through file ACLs, using command 'setfacl'. But with SGID, what you are trying to accomplish is not possible.


All times are GMT -5. The time now is 07:04 PM.