Nos sistemas baseados em Debian (incluindo o Ubuntu), os pacotes criam usuários usando scripts de mantenedores , geralmente postinst
. Portanto, uma maneira pode ser percorrer esses scripts:
grep -R --include='*.postinst' -e useradd -e adduser /var/lib/dpkg/info/
Isso pressupõe, é claro, que o script postinst
não tenha sido excluído (manualmente ou porque você desinstalou o pacote em questão).
A política do Debian parece favorecer postinst
:
[Y]ou must arrange for your package to create the user or group if necessary using
adduser
in thepreinst
orpostinst
script (again, the latter is to be preferred if it is possible).
O mantenedor do pacote também pode usar preinst
, contanto que adduser
seja uma pré-dependência.
A política também nos leva à outra origem de contas: o pacote base-passwd
, conforme indicado no parágrafo anterior:
If you need a statically allocated id, you must ask for a user or group id from the
base-passwd
maintainer, and must not release the package until you have been allocated one. Once you have been allocated one you must either make the package depend on a version of thebase-passwd
package with the id present in/etc/passwd
or/etc/group
, or arrange for your package to create the user or group itself with the correct id (usingadduser
) in itspreinst
orpostinst
. (Doing it in thepostinst
is to be preferred if it is possible, otherwise a pre-dependency will be needed on the adduser package.)
A documentação base-passwd
( /usr/share/doc/base-passwd/users-and-groups.txt.gz
ou /usr/share/doc/base-passwd/users-and-groups.html
) diz:
The Debian base-passwd package contains the master versions of /etc/passwd and
/etc/group. The update-passwd tool keeps the entries in these master files in
sync on all Debian systems. They comprise only "global static" ids: that is,
those which are reserved globally for the benefit of packages which need to
include files owned by those users or groups, or need the ids compiled into
binaries.
Os usuários / grupos incluídos são (grepped out de /usr/share/doc/base-passwd/users-and-groups.txt.gz
):
Usuários (geralmente com grupos correspondentes)
root man majordom irc gdm
daemon lp postgres gnats saned
bin mail www-data nobody klog
sys news backup messagebus syslog
sync uucp operator postfix
games proxy list haldaemon
Grupos (sem usuários correspondentes)
adm fax audio staff sshd
tty voice src users fetchmail
disk cdrom shadow lpadmin cupsys
kmem floppy utmp sasl nogroup
dialout tape video scanner
dip sudo plugdev ssh
O pacote README ( /usr/share/doc/base-passwd/README
) também lista alguns usuários com UIDs no intervalo 60000-64999 e afirma que eles são criados pelos respectivos pacotes.