LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Two groups that have different permission to the same directory - it's possible? (https://www.linuxquestions.org/questions/linux-newbie-8/two-groups-that-have-different-permission-to-the-same-directory-it%27s-possible-245522/)

immer 10-21-2004 09:16 AM

Two groups that have different permission to the same directory - it's possible?
 
Hello everybody.

Example:
Two groups (g1, g2) are configured in system. It is possible that these groups have different permissions to the same directory? For example g1: r-x g2: rwx. It is possible to resolv this problem?

Best regards.

bikov_k 10-21-2004 10:48 AM

it is possible if one group is the owner group and then the other group is just something else. But I guess that wont work for you. hm!

Why do you want to have two groups with different permissions?

KAlo

immer 10-21-2004 11:18 AM

Quote:

Originally posted by bikov_k
it is possible if one group is the owner group and then the other group is just something else. But I guess that wont work for you. hm!
g1 is a group of people that would like to write/read files in /home/share (for example) directory.
g2 is a group of people that would like to only read files in /home/share directory.

Nobody else (others for example) should have any permissions to this directory.

Quote:

bikov_k
Why do you want to have two groups with different permissions?

I would like to have two groups of people. One that would have read/write permission to the specific directory, other that can only read from that directory. No one else should have rwx permissions to that directory.

I just wonder if it's possible in Linux?

kenji 10-21-2004 11:56 AM

if you want you can use chmod 774 though it doenst create a permission
for the g2 it will set a permission read,write and execute permissions
for the user read, write and execute for the group and only read permission for
other users. only a suggestion! £Ä3

KlaymenDK 10-21-2004 12:06 PM

Quote:

Originally posted by bikov_k
it is possible if one group is the owner group and then the other group is just something else.
But I guess that wont work for you.

Have I missed some context? I don't see why this shouldn't work for you.

Let the folder be owned by the group that needs "rwx" access, and configure it to be "rx" by other groups. This means that *everybody*, not just your "g2", will get "rx" access, maybe that's what bikov_k meant.

O well, I tried.

immer 10-21-2004 01:09 PM

Quote:

Originally posted by KlaymenDK
Have I missed some context? I don't see why this shouldn't work for you.

Let the folder be owned by the group that needs "rwx" access, and configure it to be "rx" by other groups. This means that *everybody*, not just your "g2", will get "rx" access, maybe that's what bikov_k meant.

O well, I tried.

If you give permission that you wrote:
Code:

d---rwxr-x  4 user g1  1024 2004-10-21 17:52 share
not only g2 can read from that directory. Any user on the system can read files from that directory (it's not good for security reasons) . I would like, that only g1 and g2 can read from that directory. Additional I would like to give write permissions to g1. I suppose that this isn't possible in Linux system. Am I wrong?

looseCannon 10-21-2004 03:40 PM

The only way I can think to do this involves an sudo, which I don't know if you are in favor or familiar with. Here's my thought:
[list=1][*]Add all members of both groups to a new (third) group[*]Set the group for this directory to this new group (chgrp newGroup /some/dir)[*]Set the permissions to 750 for the directory[*]Set up an SUDO for the members of g1 to use to be able to write to the directory as the owner of the directory
Add something like this with visudo
Code:

Cmnd_Alias ALIASEDVI=/path/to/vi
%g1  ALL=(ownerOfDir) NOPASSWD: ALIASEDVI

You may want to set up an alias for the members of g1 to use so they won't have to type in a long command to be able to modify a file in that directory.
alias visharedfile='sudo -u USERTORUNASFROMSUDO /path/to/vi'[/list=1]

A thought, not necessarily the best one.

immer 10-22-2004 05:00 AM

Quote:

Originally posted by looseCannon
The only way I can think to do this involves an sudo...
It's clever. One disadvantage is that we have to give permission to every command that group %g1 will use. But I think that vi, cp, mv should be enough. Thank you for advice!


All times are GMT -5. The time now is 09:28 PM.