LinuxQuestions.org
Review your favorite Linux distribution.
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 12-11-2007, 06:36 AM   #1
laucian
Member
 
Registered: Oct 2005
Distribution: Ubuntu 9.04
Posts: 124
Blog Entries: 2

Rep: Reputation: 15
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 ?
 
Old 12-11-2007, 06:46 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984
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.
 
Old 12-11-2007, 06:54 AM   #3
uncle-c
Member
 
Registered: Oct 2006
Location: The Ether
Distribution: Ubuntu 16.04.7 LTS, Kali, MX Linux with i3WM
Posts: 299

Rep: Reputation: 30
Quote:
Originally Posted by acid_kewpie View Post
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
 
Old 12-11-2007, 06:56 AM   #4
laucian
Member
 
Registered: Oct 2005
Distribution: Ubuntu 9.04
Posts: 124

Original Poster
Blog Entries: 2

Rep: Reputation: 15
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?
 
Old 12-11-2007, 06:59 AM   #5
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984
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?
 
Old 12-11-2007, 07:07 AM   #6
laucian
Member
 
Registered: Oct 2005
Distribution: Ubuntu 9.04
Posts: 124

Original Poster
Blog Entries: 2

Rep: Reputation: 15
Quote:
Originally Posted by acid_kewpie View Post
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".
 
Old 12-11-2007, 08:03 AM   #7
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
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.
 
Old 12-11-2007, 09:12 AM   #8
forrestt
Senior Member
 
Registered: Mar 2004
Location: Cary, NC, USA
Distribution: Fedora, Kubuntu, RedHat, CentOS, SuSe
Posts: 1,288

Rep: Reputation: 99
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
 
Old 12-12-2007, 12:54 AM   #9
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Map Windows NT Groups to UNIX Groups - why? kenji1903 Linux - Networking 4 10-16-2007 11:52 AM
Best way to manage groups tensigh Linux - Security 5 10-09-2007 04:16 PM
Samba NT and Unix groups smclevie Linux - Server 0 01-30-2007 02:10 AM
What we have to do to manage users/groups Khmer Linux - Security 2 08-13-2005 08:35 AM
A problem with UNIX users groups pedrosan Linux - Newbie 4 06-09-2004 09:00 PM

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

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