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?