Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 08-16-2006, 10:57 AM   #1
Registered: Jun 2006
Posts: 126

Rep: Reputation: 15
Basic Question Unix (Groups)

1) I used
id <username>
command and i get only one group, but when i use Code:
groups <username>
I get three groups the same user belongs to.

Why is that?

2) When I cd to /etc/group . I find only two groups out of three (which appeared using groups <username>

3) Out of the two groups found in /etc/group .
a) one of the groups does not have the <username> in the list of members. It contains different usr_names, but not the one which was searched for.
a) the other group has only root in the members list.

Can you explain me this?

Old 08-16-2006, 11:51 AM   #2
Registered: Jun 2006
Posts: 126

Original Poster
Rep: Reputation: 15
It would be great if you could atleast tell me,

Why id <username> command returns only one group name and why groups <username> command gives more group names??

Is it something like active, expired, not used etc???
Old 08-16-2006, 12:02 PM   #3
LQ Veteran
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400

1) id comes in different versions/flavors. One shows all info regarding a user (this from my own linux box):

id druuna
uid=500(druuna) gid=500(internet) groups=500(internet),78(floppy),203(news),206(www),400(users),501(visitor)

I've also seen id implementations that only shows the uid and primary group info, _not_ the other groups that this user belongs to. I.e:

id druuna
uid=500(druuna) gid=500(internet)

The difference is found mainly between linux (first example) and unix (second example). But this is using id without any options. Some options do show all the info.

The group command should show all groups, including primary, that a user belongs to.

2) All groups should exist in /etc/group. If not the numerical value is shown, not the name (no value to name translation is possible).

a) The primary group a user belongs to does not have the name of that user behind it in the /etc/group file (this is provided in the /etc/passwd file, field 4).

Take the druuna entry for example. Behind the group internet there will be _no_ druuna. The other groups (78(floppy),203(news),206(www),400(users),501(visitor)) all have druuna behind it.

For more information also take a look at:

man group
man groups
man id

Hope this clears things up a bit.


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
Help with a basic UNIX script mike9287 Linux - Newbie 28 06-02-2006 02:14 AM
Basic fstab question -- cant' set groups or use as user. jcubed Linux - Newbie 6 12-22-2005 05:47 PM
Basic question about groups celejar Linux - General 2 07-07-2005 09:25 AM
A problem with UNIX users groups pedrosan Linux - Newbie 4 06-09-2004 09:00 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:14 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration