LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 09-11-2020, 01:31 PM   #1
n00b_noob
Member
 
Registered: Sep 2020
Posts: 436

Rep: Reputation: Disabled
Post Group within group permission.


Hello,
I created a group with the name "group1" and I want to join this group to another existed group. How can I do it?
For example, "apache" group has permission on a directory and I want to add a new group to that directory or add new group to "apache" group.
How a directory could have more than one group?

Thank you.
 
Old 09-11-2020, 01:46 PM   #2
rnturn
Senior Member
 
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,801

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
Quote:
Originally Posted by n00b_noob View Post
Hello,
I created a group with the name "group1" and I want to join this group to another existed group. How can I do it?
For example, "apache" group has permission on a directory and I want to add a new group to that directory or add new group to "apache" group.
How a directory could have more than one group?
You could simply add members to the "apache" group.

I know of no way to have more than one group access defined for an object... other than creating an access control list (ACL) for the object (file, directory, etc.). In the ACL, you would specify the groups that you need/want to have access to it---and the access they're allowed to have. See the manpages for "getfacl(1)", "setfacl(1)", and, especially, "acl(5)" for the details.

HTH...

Last edited by rnturn; 09-11-2020 at 01:48 PM.
 
Old 09-11-2020, 01:54 PM   #3
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 3,340

Rep: Reputation: Disabled
Unix does not support the concept of nested groups, so that option's out.

Standard Unix file/directory permissions only allow for three sets of permissions: One set for the owning user, one set for the owning group, and one set for everybody else. You may however use Access Control Lists, provided both your kernel and the filesystem in question supports it (they almost certainly do, unless you run a truly ancient/weird kernel and/or FS). You may have to add the "acl" option to /etc/fstab in order to activate this feature, though.

As rnturn said, the man pages for the userspace utilities (man setfacl and man getfacl) should contain enough information to get you started.
 
Old 09-11-2020, 01:56 PM   #4
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,307
Blog Entries: 3

Rep: Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721
As mentioned, ACLs can add multiple groups to a directory. The manual pages mentioned are an authoritative reference. There are not many guides or tutorials out there, however.

It usually a rare occurrence to need an ACL though. So can you clarify what you are trying to set up and we may be able to find a less complicated way to solve the problem.
 
Old 09-11-2020, 04:31 PM   #5
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,727

Rep: Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211
Yes. There's no reason to mess with groups in your DocumentRoot space.
Make directory for your user...owned by them and using their group.
Insure that that directory is chmod 755
Insure that any files in that directory are 644
...that's managed by the user's umask setting. Typically, you shouldn't need to change that, but just touch a file in that directory to confirm that files created by that user are 644
Here's a snippet of our DocumentRoot
Code:
drwxr-xr-x.  7 user1  users  8192 Feb 26  2018 site1
drwxr-xr-x. 18 user2  users 16384 Jul 23 14:51 site2
drwxr-xr-x.  3 user3  users  4096 Nov 27  2014 site3
drwxr-xr-x.  5 user3  users  4096 Jul 18 10:34 site4
drwxr-xr-x.  5 user4  users  4096 Jun 26  2009 site5
user1, user2 and user4 each own their own space and can upload files to them as they wish.
user3 is me. I maintain site3 and site4.
Because the directories and files are world/other readable, the web server can serve them.

This is all guess at the problem you're trying to solve of course, but we see these questions about web spaces a lot, and I've been operating a webserver just this way for two decades with no problems.
 
Old 09-12-2020, 12:33 PM   #6
n00b_noob
Member
 
Registered: Sep 2020
Posts: 436

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Turbocapitalist View Post
As mentioned, ACLs can add multiple groups to a directory. The manual pages mentioned are an authoritative reference. There are not many guides or tutorials out there, however.

It usually a rare occurrence to need an ACL though. So can you clarify what you are trying to set up and we may be able to find a less complicated way to solve the problem.
I want a new group have the same permission of "apache" group on a same directory.
 
  


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
question: 'onclick' within 'onmouseover' within 'form' within 'table' - how is it possible? rblampain Programming 4 04-25-2017 08:49 PM
Execute with group permission but write with other permission? Karmaflute Linux - Newbie 15 05-01-2013 07:00 PM
[SOLVED] user removed from one group can still get that group's permission LanFan.BlueSailor Linux - Security 11 08-23-2012 12:32 AM
group permission the sticky bit permission comes in capital 'S' pkishorenayak Linux - Newbie 1 04-11-2008 05:04 PM
Strange behavior: string within scope return 0 if not within a while loop. RHLinuxGUY Programming 2 08-05-2006 11:05 PM

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

All times are GMT -5. The time now is 11:13 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