LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Group Questions (https://www.linuxquestions.org/questions/linux-newbie-8/group-questions-761835/)

scucci 10-14-2009 09:00 AM

Group Questions
 
Hello,

I was working with groups last night and came across a few questions.

1. Why do you need a GID?
2. Why would a group need a password?
3. What is the proper way to add a user to a group? Some of the materials I was using were telling me to use "groupmod" while others were telling me to use "useradd -G". I got errors on both.

Thanks

pingu 10-14-2009 09:30 AM

1. Not sure what you mean, why GID or why groups - let's answer both:
Groups are needed to give several accounts same permissions. For instance, all users that shall have access to sound are members of the "audio" group. Without groups that would be pretty difficult to accomplish.
GID:s - well, 'puters uses numbers not names, names are for humans.
It's the same with UID - it doesn't really matter what name an account has it's the uid that actually is set.

2. AFAIK it's not really needed - I have never seen a password actually being used for a group. Can't swear on this though, maybe sometimes they're actually used?

3. "The proper way" to do whatever it is, is the way you feel is the best for you.
For group membership all that's needed is to add the user to the group in the file /etc/group.
It looks like this:
Code:

cdrom:x:24:harald,pingu
floppy:x:25:harald,pingu
tape:x:26:pingu
sudo:x:27:
audio:x:29:harald,pingu

So that's groupname: password or not:gid:members
As you can see here, harald & pingu both has access to cd, floppy and audio. Only pingu has access to tape drive. No user can use sudo.

There are several tools (gui & text) to handle users & groups, try a few and use whatever you like (as long as it works of course). If you get errors it could be either a lousy app or (more likely) you are actually doing something wrong. Post the error here if you need help!


All times are GMT -5. The time now is 04:54 PM.