Ludovic Courtès <l...@gnu.org> writes: > Mark H Weaver <m...@netris.org> skribis: > >> Here's one idea: when activating a system, *never* delete users or >> groups if files still exist that are owned by those users/groups. >> Checking all filesystems would likely be too expensive, but perhaps it >> would be sufficient to check certain directories such as /var, /etc, and >> possibly the top directory of /home. > > How would you determine which directories to look at though? What if we > miss an important one?
I have another idea: Maintain historical mappings from user/group names to UIDs/GIDs, perhaps in some file in /etc, where entries are added but *never* automatically removed. When allocating UIDs/GIDs, we would avoid any UIDs/GIDs in the range of those mappings. Then, provide a UID/GID garbage collector, to be explicitly run by users if desired, which would scan all filesystems to find the set of UID/GIDs currently referenced, and remove entries from the historical mappings that are no longer needed. What do you think? Mark