Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Comments on Group and users seem to disagree about whether the users are in the group

Post

Group and users seem to disagree about whether the users are in the group

+1
−0

On my current setup (running Linux Mint 20.3 Cinnamon), I have an administrative user and several ordinary users. I intend for all of these users to be in the same group, which happens to have the same name as the admin user name. (After doing the basic guided setup and looking up some tutorials, I used adduser to create the standard users and set them to be in the admin user's group.)

Thus, my /etc/passwd contains entries like (anonymized):

adminuser:x:1000:1000:,,,:/home/adminuser:/bin/bash
basicuser:x:1001:1000:Boring Username,,,:/home/basicuser:/bin/bash
plainuser:x:1002:1000:Cliche Username,,,:/home/plainuser:/bin/bash

To my understanding, this should mean that all the users have primary group 1000 (named adminuser) - and therefore, the group with that id should be known to contain all these users.

Acting as the admin user, I try querying what groups basicuser is in:

$ id basicuser 
uid=1001(basicuser) gid=1000(adminuser) groups=1000(adminuser)

$ groups basicuser 
basicuser : adminuser

This is as I expect. However, if I now try using getent to query the group to see which users are in it, I only see the admin user:

$ getent group 1000
adminuser:x:1000:adminuser

Why doesn't it report adminuser:x:1000:adminuser,basicuser,plainuser? Is there a different way I should query for this, or something I have overlooked to make the group membership properly recognized?

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.
Why should this post be closed?

1 comment thread

Why? Because `getent group` with common `nsswitch.conf` uses `/etc/group` as the database. For each u... (1 comment)
Why? Because `getent group` with common `nsswitch.conf` uses `/etc/group` as the database. For each u...

Why? Because getent group with common nsswitch.conf uses /etc/group as the database. For each user the information about the primary group is in /etc/passwd though, not in /etc/group.