LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-21-2004, 09:16 AM   #1
immer
LQ Newbie
 
Registered: Oct 2003
Location: Somewhere in Europe :-)
Distribution: Linux Mint
Posts: 29

Rep: Reputation: 15
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.
 
Old 10-21-2004, 10:48 AM   #2
bikov_k
Member
 
Registered: Sep 2004
Distribution: Fedora Core 5
Posts: 33

Rep: Reputation: 15
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
 
Old 10-21-2004, 11:18 AM   #3
immer
LQ Newbie
 
Registered: Oct 2003
Location: Somewhere in Europe :-)
Distribution: Linux Mint
Posts: 29

Original Poster
Rep: Reputation: 15
Question

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?
 
Old 10-21-2004, 11:56 AM   #4
kenji
Member
 
Registered: Sep 2004
Location: Philippines
Distribution: Slackware
Posts: 143

Rep: Reputation: 16
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
 
Old 10-21-2004, 12:06 PM   #5
KlaymenDK
Member
 
Registered: Sep 2003
Location: Denmark
Distribution: FreeBSD v6.0
Posts: 123

Rep: Reputation: 15
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.
 
Old 10-21-2004, 01:09 PM   #6
immer
LQ Newbie
 
Registered: Oct 2003
Location: Somewhere in Europe :-)
Distribution: Linux Mint
Posts: 29

Original Poster
Rep: Reputation: 15
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?
 
Old 10-21-2004, 03:40 PM   #7
looseCannon
Member
 
Registered: Dec 2003
Location: Little Rock, AR
Distribution: Fedora Core 2, AIX, HP-UX, Solaris, Whitebox
Posts: 193

Rep: Reputation: 31
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.
 
Old 10-22-2004, 05:00 AM   #8
immer
LQ Newbie
 
Registered: Oct 2003
Location: Somewhere in Europe :-)
Distribution: Linux Mint
Posts: 29

Original Poster
Rep: Reputation: 15
Thumbs up

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!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
File and directory permissions or groups kuplo Linux - Newbie 1 11-11-2005 03:06 AM
Protecting a directory with chmod, owner, groups, others clarence1720 Linux - Newbie 12 11-06-2004 01:33 AM
Active Directory Groups with Samba??? beat_researcher Linux - Networking 0 06-14-2004 04:33 PM
2 groups work in one directory. monc Linux - Networking 3 10-15-2003 06:10 AM
Directory access via groups ghight Linux - General 1 04-19-2003 11:33 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:37 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration