Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I am trying to remove the "users" group and it tells me I can't remove someones primary group however when I check /etc/group, I show nobody's name next to the GID. Is there a command I can run that will tell me all the members of the specific GID or how can I check who is a member of this group?
A users primary group is set in the /etc/passwd file. It is the fourth entry and listed numerically. To delete the group you will first need to delete the user or change their primary group.
# grep test /etc/passwd
test:x:506:65534::/:/bin/bash
# grep 65534 /etc/group
nogroup:x:65534:
If you take a look in the /etc/passwd file, you will see that none of the groups are listed by name, only by GID. Try grepping for '508' through your passwd file, as that seems to be the GID of your 'users' group.
OK that makes sense. For some reason when I look for 508 in /etc/passwd, I find a boat load of accounts with gid of 508. Not sure why they don't show up on /etc/group under the users section. Is it safe to modify the /etc/passwd file by hand?
If you are just looking to adjust their primary group (make sure to have them in at least one group), it shouldn't be an issue to edit them manually, though there's likely some command-line tool for doing just that if you don't want to get your hands dirty in /etc/passwd
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.