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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
05-26-2012, 01:36 PM
|
#1
|
LQ Newbie
Registered: May 2012
Posts: 15
Rep:
|
Permissions for a Directory depending on what group (GID) user is in
Hi I'm running: Linux version 2.6.16.60-0.59.1-smp (gcc version 4.1.2 20070115 (SUSE Linux)) #1 SMP
Not sure if that's relevant or not. Sorry for the eye roller, but I've done some googling and it seems like I want the 'chmod' command, but I can't figure out exactly what I need to do.
I have two user groups, 4100 and 4200.
I want 4100 to have read/write/execute/delete access to a particular directory, and I want 4200 to only have read access to a directory. I've been fighting this for a couple of hours, I'd appreciate some direction.
|
|
|
05-26-2012, 01:50 PM
|
#2
|
Senior Member
Registered: Jan 2012
Distribution: Slackware
Posts: 3,348
Rep:
|
A directory in Unix can only be owned by one group. If the directory is owned by 4100, you can give that group r/w/x permissions, but members of 4200 would then have the same rights as every other non-member of 4100.
The above is true for the standard Unix permission model, and it cannot handle a scenario like the one you presented. What you probably want, is a filesystem feature called Access Control Lists (ACLs). man mount and man fstab will tell you how to enable ACLs on your filesystem, and man setfacl will tell you how to create and manipulate ACLs.
|
|
1 members found this post helpful.
|
05-26-2012, 01:50 PM
|
#3
|
LQ Addict
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 23,301
|
it looks easy. Just set the group id 4100 to that particular directory, and set full permission to the group and set read permission to others.
|
|
|
05-26-2012, 01:54 PM
|
#4
|
LQ Newbie
Registered: May 2012
Posts: 15
Original Poster
Rep:
|
Ser Olmy: Thank-you for the response, the second response I got seems to be the more quick and dirty approach that I'm looking for here.
Quote:
Originally Posted by pan64
it looks easy. Just set the group id 4100 to that particular directory, and set full permission to the group and set read permission to others.
|
How do I go about doing that?
|
|
|
05-26-2012, 02:04 PM
|
#5
|
LQ Addict
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 23,301
|
you need to use chmod to change/set permissions and chgrp to change group
_____________________________________
If someone helps you, or you approve of what's posted, click the "Add to Reputation" button, on the left of the post.
Happy with solution ... mark as SOLVED
(located in the "thread tools")
|
|
|
05-26-2012, 02:09 PM
|
#6
|
LQ Newbie
Registered: May 2012
Posts: 15
Original Poster
Rep:
|
[QUOTE=pan64;4688267]you need to use chmod to change/set permissions and chgrp to change group
OK. When I go through chmod manual pages, I'm not sure exactly what I'm looking for to accomplish this. I understand this is some serious hand holding, but how exactly do I do this? The directory is already the appropriate group.
|
|
|
05-26-2012, 02:17 PM
|
#7
|
LQ Newbie
Registered: May 2012
Posts: 15
Original Poster
Rep:
|
would it be 'chmod o+r-wx directoryname'?
|
|
|
05-26-2012, 02:20 PM
|
#8
|
LQ Addict
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 23,301
|
you can test it easily I think, as you described it should be ok.
_____________________________________
If someone helps you, or you approve of what's posted, click the "Add to Reputation" button, on the left of the post.
Happy with solution ... mark as SOLVED
(located in the "thread tools")
|
|
|
05-26-2012, 04:22 PM
|
#9
|
Senior Member
Registered: Jan 2010
Location: SI : 45.9531, 15.4894
Distribution: CentOS, OpenNA/Trustix, testing desktop openSuse 12.1 /Cinnamon/KDE4.8
Posts: 1,144
|
Hi caiphn,
for me it was easier to remember the "chmod" values by numbers (octal mode) than letters,
so it goes:
Code:
chmod ugo filename/directory_name
ugo - meaning
User Group Others
and the values for:
r(ead) - 4
w(rite) - 6
e(x)ecute - 5
all enabled - 7
which would then be used in your case like:
Code:
chmod 775 directoryname
775 meaning:
7- read/write/execute - Owner
7- r/w/x - Group
5- eXecute - others (meaning can read the directory)
Last edited by lithos; 05-26-2012 at 04:24 PM.
|
|
1 members found this post helpful.
|
05-26-2012, 04:29 PM
|
#10
|
LQ Newbie
Registered: May 2012
Posts: 15
Original Poster
Rep:
|
Excellent! Thank-you so much for clearing that up for me, lithos!
Quote:
Originally Posted by lithos
Hi caiphn,
for me it was easier to remember the "chmod" values by numbers (octal mode) than letters,
so it goes:
Code:
chmod ugo filename/directory_name
ugo - meaning
User Group Others
and the values for:
r(ead) - 4
w(rite) - 6
e(x)ecute - 5
all enabled - 7
which would then be used in your case like:
Code:
chmod 775 directoryname
775 meaning:
7- read/write/execute - Owner
7- r/w/x - Group
5- eXecute - others (meaning can read the directory)
|
|
|
|
05-26-2012, 05:05 PM
|
#11
|
Senior Member
Registered: Jan 2010
Location: SI : 45.9531, 15.4894
Distribution: CentOS, OpenNA/Trustix, testing desktop openSuse 12.1 /Cinnamon/KDE4.8
Posts: 1,144
|
No problem,
that's how I remembered,
here is more detailed explanation of permissions in linux.
You will master it.
|
|
|
All times are GMT -5. The time now is 02:47 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|