Two places possible: /etc/group and /etc/passwd.

If I use command: adduser [username] [groupname], then the user would be added to the group, and the file /etc/group would then be updated.

However, the file /etc/passwd is not updated. if I check which group I belongs to, via groups command, I can only see groups stated in passwd file.. therefore, the user is not added to the group base on this result.

Mirror Question: https://stackoverflow.com/questions/31530362/where-how-is-user-group-information-stored-in-ubuntu. (I'll remove one of them after I got the answer)

I'm confused.

  1. What's the meaning of storying group info into /etc/passwd, and /etc/group respectively?
  2. Why adduser only update the group file?
  3. How to add group to the passwd file via command?
  4. Why does groups return group info from passwd file, but not group file?


closed as off-topic by Michael Homer, cuonglm, maxschlepzig, Archemar, G-Man Jul 21 '15 at 9:30

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question has been posted on multiple sites. Cross-posting is strongly discouraged; see the help center and community FAQ for more information." – Michael Homer, cuonglm, maxschlepzig, Archemar, G-Man


The list of groups a user belongs to is stored in /etc/group When you add a user to group /etc/group is updated. The /etc/passwd file doesn't tell you which users belong to which groups. It only has the group id of the user's default group. The groups command returns info from /etc/group

  • Why do we have default group thing? – songyy Jul 21 '15 at 4:50
  • The default group is used to determine group ownership of files/directories created by a user. For example, if I belong to three groups and create a new file, the group that the file is owned by is my default group (as taken from /etc/password). – mjturner Jul 21 '15 at 6:51

/etc/group lists all the groups, when you issue the command:


It shows you all the groups you belong to, Which is gotten from /etc/group

/etc/passwd shows all the information for a user, stuff like username, userid, default groupid, home directory, and your default shell. The user is added to this file once you create then via adduser.

Another interesting command is:


This will list all the real and effective user and group id's.

Not the answer you're looking for? Browse other questions tagged or ask your own question.