How can I remove a group (which was previously deleted) from a user which still references it? If I run groups, I get an error about a non-existent group:$ groupsmyuser dialout cdrom sudo dip plugdev fuse lpadmin sambashare groups: cannot find name for group ID 10011001The usual way of using deluser doesn't work because the group name no longer exists and there seems to be no flag for using IDs:$ deluser myuser 1001The group `1001' does not exist.Is there a more straight forward way to remove a group (by ID) from a user other than by recreating the group, deleting the group from the user, and then redeleting the group?
Remove group ID from user
users;group
groups show you the groups you are in. So the problem is that your process thinks you still are in the now deleted 1001 group, from the deluser myuser 1001 command.You still would get that error message from groups as long as the process you started thinks you are in the group. When doing these kind of things in bash for my own account, I normally start a new shell to make sure that things are as I want them to be in that shell.In your case starting a new shell should solve the issue, if not then the group would still exists in /etc/group and then deluser would not complain.