0

I have read Linux: id: cannot find name for group ID 999 but that does not answer my problem. The following is what I got (the username ABC and group name NAMEX are fictitious, I did adduser NAMEX, upon creation the group name NAMEX was created automatically)

When I logged in as user ABC and typed "groups ABC" I got:

ABC : ABC adm cdrom sudo dip plugdev lxd git NAMEX

But if I typed "groups" instead I got:

ABC : ABC adm cdrom sudo dip plugdev groups: cannot find name for group ID 515
515

grep 515 /etc/group returns nothing

grep ABC /etc/group gives:

adm:x:4:syslog,ABC
....
ABC:x:1000:
git:x:509:ABC,NAMEX
NAMEX:1002:user1,user2...,ABC

touch filename.txt failed due to Permission denied:

-rw-rw-r-- 1 NAMEX NAMEX 1234 Dec 1 17:01 filename.txt

I tried removing ABC from group NAMEX with gpasswd -d and adding back with usermod -a -G, that did not help.

How can I fix?

cpliu338
  • 101
  • 1
  • 2
  • First, try to log out and then log in again with a new completely new session. Regarding the file, check the actual `gid` of the file (you could use `stat`). By the way, notice that your second `groups` also didn't show groups `lxd` and `git`. Last thing, check your `/etc/nsswitch.conf`, if it only uses local files for groups and users or if there's also nis or ldap or some other map services. – aviro Dec 06 '21 at 07:54
  • stat gives me a gid of 1002 as expected. The second groups broke after printing plugdev. But /etc/group shows that plugdev has a gid of 46, lxd has a gid of 116, not gid 515 which is the complaint of unknown group. /etc/nsswitch.conf shows group: files systemd. Nothing like nis/ldap in that file – cpliu338 Dec 07 '21 at 05:42

0 Answers0