LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to manage unix/linux groups (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-manage-unix-linux-groups-606025/)

laucian 12-11-2007 06:36 AM

how to manage unix/linux groups
 
hi everyone,
i need some knowledge about managing users and groups on a linux machine therefore i have a few questions..

1. does every user belong to a group?

2. case : user belongs to more then one group and creates a file..for which groups belongs the files(default) ?

3. how can i see a whole list of the users and the groups they are belonging to ?

acid_kewpie 12-11-2007 06:46 AM

1. yes, although many distro's marginalize users groups by putting each user into their own group.

2. their main group as defined in /etc/passwd

3. nothign offhand to spool all that out, but "id -a username" will list all the groups for one user.

uncle-c 12-11-2007 06:54 AM

Quote:

Originally Posted by acid_kewpie (Post 2987035)
3. nothign offhand to spool all that out, but "id -a username" will list all the groups for one user.

This is what makes Linux so fascinating. A "Little gem of a command" like the above always seem to spring out of nowhere ! Thanks AK !!!! Its a lot more convenient than viewing the etc/group file.

Thanks again !
Uncle-c

laucian 12-11-2007 06:56 AM

Code:

cumhur@mfc-falter:~> id -a cumhur
uid=1010(cumhur) gid=100(users) groups=100(users),16(dialout),33(video)
cumhur@mfc-falter:~> whoami
cumhur
cumhur@mfc-falter:~> mkdir test
cumhur@mfc-falter:~> ls -l
total 44
drwx------ 5 cumhur users 12288 Dec 11 11:53 Desktop
drwx------ 2 cumhur users  4096 Aug  7 13:17 Documents
drwxr-xr-x 2 cumhur users  4096 Aug  7 13:17 bin
drwxr-xr-x 2 cumhur users  4096 Aug  7 13:17 public_html
drwxr-xr-x 2 cumhur users  4096 Dec 11 13:54 test

so there is a user named "cumhur", he belongs to groups users, dialout and video, and the files created by him will be created as default under the users group..is it right?

if yes, how can i modify it? i want to create another group with the same as the user "cumhur" and the user "cumhur" belongs only to this group..

another question, what does dialout and video groups mean/do..what happens if i remove user "cumhur" out of the groups?

acid_kewpie 12-11-2007 06:59 AM

not sure what you're actually asking... you want to create another user with the same name??

as for what the other groups are, dialout is presumably the group with permission to dial a modem link, and video? no idea to be honest... obviously some sort of ownership about video device access.. possibly for accelerated access like OpenGL?

laucian 12-11-2007 07:07 AM

Quote:

Originally Posted by acid_kewpie (Post 2987049)
not sure what you're actually asking... you want to create another user with the same name??

sorry for my chaotic english..i just want to create another group called "cumhur" (just as the user), place the user to this group and remove from the group "users".

jschiwal 12-11-2007 08:03 AM

First you need to create a "cumhur" group. Then you need to make this group the users default group. The second part can be done using the "usermod" command. Your distro may have a gui config program where you can manage groups and users if that is how you want to proceed.

See the manpages for groupadd, groupdel, groupmod, usemod, passwd and shadow.

forrestt 12-11-2007 09:12 AM

Quote:

Your distro may have a gui config program where you can manage groups and users ...
Doesn't anybody just vi the passwd, group, and shadow files anymore? :)

Forrest

jschiwal 12-12-2007 12:54 AM

If you want to edit the /etc/passwd or /etc/group files directly, you should use "vipw" or "vigr" respectively. This will add error correction. You will also be using the "vim" program. However, using usermod, etal would be better because some changes need to be reflected also in /etc/shadow.

The OP hasn't learned anything about these utilities yet and will probably torch up his system editing /etc/passwd directly.
However, I did direct him to the manpages for passwd and shadow.


All times are GMT -5. The time now is 08:02 AM.