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:
$ groups
myuser dialout cdrom sudo dip plugdev fuse lpadmin sambashare groups: cannot find name for group ID 1001
1001
The 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 1001
The 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?
--uid=1001
), remove it from the user's groups, and delete it again.