LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 10-04-2011, 01:38 PM   #1
shojen
LQ Newbie
 
Registered: Oct 2011
Posts: 5

Rep: Reputation: Disabled
Users and Groups - Need clarification (CLI based)


Hello All,

I need clarification with users and groups. Firstly, I get the permissions part with rwx options for ugo. I know how to apply them with chmod and understand how it affects files/folders.

What I need clarification on is how groups can be used to control access/permissions.

Here's an example:

I'm an administrator. I've created two new groups, group1 and group2. I want the users in group1 to be able to rwx any file that users in group2 create. However, the group2 users cannot _wx to any file group1 creates.

I know I can apply those permissions to individual files as they are created by either group. How can I assign those permissions to the group as a whole so that whenever a user creates a file, that file automatically inherits the permissions of the group?

Thanks!
 
Old 10-04-2011, 06:26 PM   #2
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
There are a couple of options,

Option 1
Add group2 as a secondary group for all the group1 users:
Code:
for user in $(groupmems -g group1 -l)
do
    usermod -a -G group2 $user
done
Add group sticky bit to relevant directories:
Code:
chmod g+s <directory>
.. this ensures that the group owning the directory will also be the owner of any files created in it, but group1 will have the same permissions as group2.

Option 2
Use setfacl to add permissions for group1 to the relevant directory
Code:
setfacl -R -m group:group1:rwx <directory>
.. this will allow group1 to have different permissions than group2 to the same files

Ensure acl support is present for the file system:
Code:
grep <partition> /etc/mtab
... and look for user_xattr.

Please note that both of these options are based on file system permissions tied to specific directories.

Last edited by kbp; 10-04-2011 at 06:30 PM.
 
Old 10-05-2011, 12:09 PM   #3
shojen
LQ Newbie
 
Registered: Oct 2011
Posts: 5

Original Poster
Rep: Reputation: Disabled
Thank you, kbp!

I will allow my brain to digest what you've said!
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] samba : how to synchronize AD users & groups with Samba users &groups zelycorn Red Hat 5 05-12-2011 09:15 AM
Is CLI and GUI the only tools that can be used to add users and groups within Linux? sharee Linux - Newbie 7 05-01-2010 07:17 PM
System Groups from Users and Groups measekite Linux - General 3 05-05-2009 09:22 PM
LXer: Garmin Nuvifone Clarification: Linux-based but not Android LXer Syndicated Linux News 0 12-26-2008 05:20 PM
CLI based Text manipulation selfsck Linux - General 1 07-15-2004 07:11 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:35 AM.

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