Reserved UIDs/GIDs and semi-reserverd UIDs/GIDs

When installing a new system, depending on selected packages, some uids for some packages aren't always the same.

eg: 'sshd' may be UID 102, sometimes another value. On the other hand, 'www-data' is always '33'

How can I figure out all packages with reserved UIDs (ie www-data) and all the packages that generate a pseudo-random administration UID (<1000, ie: sshd)? This goes for GIDs too.

Is there a list of all those packages? Or is there an aptitude command that let's me find out all those packages, even the ones not installed?

Thanks


The UIDs and GIDs 0-99 are fixed and always the same. They are created by the package base-passwd.

The 100-999 are dynamically allocated, usually in the order the users/groups are created on your system.

See the section "UID and GID classes" in the Ubuntu Policy Manual for some more classes.

As far as I know there is no list of packages that create users or groups.

Packages create the additional users and groups in their *.preinst and *.postinst scripts. So to find the installed packages that have created users

grep 'adduser ' /var/lib/dpkg/info/*inst

may be a starting point (replace adduser with addgroup for groups).