Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Managing group permissions
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
Remillard
Apprentice
Apprentice


Joined: 07 Mar 2003
Posts: 200
Location: Irvine, CA

PostPosted: Mon Jul 26, 2004 7:50 pm    Post subject: Managing group permissions Reply with quote

Hello,

I can't believe I can't figure out what's wrong with this setup, but it's got me stumped.

I have a partition mounted as /media off the root. The purpose of this is to store mp3, avi, etc. Basically huge stuff that I don't want backed up when I do regular user backups. I would like all users to be able to read and execute content here, but only members of group media to be able to write.

So, I created 'media' with groupadd. Success.
I added myself to the group line in /etc/group. Success.
As root I chgrp'd all files and directories for /media to group 'media'.

Okay, at this point we have:
In /:
drwxrwxrwx 6 root media 120 Jul 26 12:21 media
In /media:
drwxrwxr-x 2 root media 768 Apr 6 22:50 iso
drwxrwxr-x 3 root media 72 Apr 6 22:42 movies
drwxrwxr-x 41 root media 1288 Jun 27 14:17 mp3

In /media, as myself, I can create files ('touch test') and they appear. In mp3, iso, and movies I CANNOT create files ('touch test' returns "Permission denied"). As far as I can tell, the only reason I can touch a file in /media is because it has others+write on it. I'm not certain why I cannot write.

In group, I have:
media:x:408:mnorton

In gshadow, I have:
media:!::

If as myself I run 'newgrp media' it asks me for a password. I never set up a password for this group.

Is there something additional I need to do to create a group? I thought I had all these filesystem and permissions things down cold years ago, but I admit I've not played with groups much.

Regards,
Remillard
_________________
This signature is printed with 100% post-consumer recycled electrons.
Back to top
View user's profile Send private message
ctford0
l33t
l33t


Joined: 25 Oct 2002
Posts: 774
Location: Lexington, KY,USA

PostPosted: Mon Jul 26, 2004 7:58 pm    Post subject: Reply with quote

you created the group but now you need to add yourself to the group...

thats done with usermod. Be very careful because you can easily eliminate all of your group memberships :(

Code:

bash-2.05b# usermod --help
usage: usermod  [-u uid [-o]] [-g group] [-G group,...]
                [-d home [-m]] [-s shell] [-c comment] [-l new_name]
                [-f inactive] [-e expire ] [-p passwd] [-L|-U] name


the -g option is for your primary group, ie. users
the -G option is for all of your other groups, it is a comma seperated list.

to activate your new group membership you need to logout and back in...

chris
Back to top
View user's profile Send private message
Rav70
l33t
l33t


Joined: 11 Feb 2004
Posts: 607
Location: Poland

PostPosted: Mon Jul 26, 2004 8:07 pm    Post subject: Re: Managing group permissions Reply with quote

Remillard wrote:
Hello,

So, I created 'media' with groupadd. Success.
I added myself to the group line in /etc/group. Success.
As root I chgrp'd all files and directories for /media to group 'media'.

Okay, at this point we have:
In /:
drwxrwxrwx 6 root media 120 Jul 26 12:21 media
In /media:
drwxrwxr-x 2 root media 768 Apr 6 22:50 iso
drwxrwxr-x 3 root media 72 Apr 6 22:42 movies
drwxrwxr-x 41 root media 1288 Jun 27 14:17 mp3

In /media, as myself, I can create files ('touch test') and they appear. In mp3, iso, and movies I CANNOT create files ('touch test' returns "Permission denied"). As far as I can tell, the only reason I can touch a file in /media is because it has others+write on it. I'm not certain why I cannot write.

you did remember to logout and login again after adding yourself to the 'media' group, did you? :)
Remillard wrote:

In group, I have:
media:x:408:mnorton

In gshadow, I have:
media:!::

If as myself I run 'newgrp media' it asks me for a password. I never set up a password for this group.


TTBOMK it should be:
Code:

media:::mnorton

Regards,
Rav
_________________
Q: Why is Microsoft's Product Support a failure?
A: Because Microsoft needs a Support Group instead.
Back to top
View user's profile Send private message
Remillard
Apprentice
Apprentice


Joined: 07 Mar 2003
Posts: 200
Location: Irvine, CA

PostPosted: Mon Jul 26, 2004 8:30 pm    Post subject: Reply with quote

ctford0 wrote:
you created the group but now you need to add yourself to the group...

thats done with usermod. Be very careful because you can easily eliminate all of your group memberships :(



This is why I usually modify groups with manually editing the /etc/group file and adding usernames in the various lists. I do not remember my group memberships in a complete list.

ctford0 wrote:
to activate your new group membership you need to logout and back in...


Well I did end my shell, and then restart the shell. I am guessing this is not the same as a full logout and login? ;-).

Regards,
Remillard
_________________
This signature is printed with 100% post-consumer recycled electrons.
Back to top
View user's profile Send private message
zimzum
n00b
n00b


Joined: 26 Jul 2004
Posts: 14

PostPosted: Tue Jul 27, 2004 11:21 am    Post subject: Reply with quote

grep username /etc/group

^--complete list of group memberships
Back to top
View user's profile Send private message
ctford0
l33t
l33t


Joined: 25 Oct 2002
Posts: 774
Location: Lexington, KY,USA

PostPosted: Tue Jul 27, 2004 12:05 pm    Post subject: Reply with quote

seeing what groups you belong to is uber easy....

Code:

bash-2.05b$ groups
users wheel audio video games


You can also do this as root to other users...

Code:

bash-2.05b# groups ctford0
wheel audio video games users


And yes you have to completely log out and back in. So if you are possibly running an X session then you need to logout of that as well.

chris
Back to top
View user's profile Send private message
Remillard
Apprentice
Apprentice


Joined: 07 Mar 2003
Posts: 200
Location: Irvine, CA

PostPosted: Tue Jul 27, 2004 5:36 pm    Post subject: Reply with quote

Yeah, logging out was the crucial trick. Thanks all!
_________________
This signature is printed with 100% post-consumer recycled electrons.
Back to top
View user's profile Send private message
Reformist
Guru
Guru


Joined: 06 Oct 2002
Posts: 323

PostPosted: Tue Aug 03, 2004 7:31 am    Post subject: Reply with quote

That's great, but sometimes I'm fiddling with my groups in X and don't want to have to log out of X to register the changes.

If I switch to the cmdline via Ctrl + Alt + Fkey, and log in there, the changes to /etc/group registers. If I simply open a new term in X, the changes do not register.

Is there anyway to force the group file to be reread without logging out of X? I understand the effects don't propogate to other terminals, I just want to force the update in one terminal so that I can make sure I have the setup right.

newgrp [groupname] prompts me for a password when I run it, and I haven't set a password on certain group names, so I'm not sure what's supposed to be entered there.
_________________
-Phil Crosby
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum