Locate Members of a Group?
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?
Thanks! |
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: |
Something is wrong here...
Code:
[root@lt2fs3 /]# grep users /etc/passwd |
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
Personally I've never had a problem with it. |
I just opened vim and ran:
:%s/508/100/g The above replaced all 508 groups with 100 GID and then I saved it and removed the group. Thanks all! |
All times are GMT -5. The time now is 10:44 AM. |