Where are users and groups defined?

Usually, a Linux system has an /etc/passwd and a /etc/group where all users are defined.

Here, in my case Aurora, both files contain only a couple of entries. Also /usr/etc/passwd and /usr/etc/group contain only a couple of entries.

For example id avahi gives
uid=70(avahi) gid=70(avahi) groups=70(avahi)

But where is this user (and all the other users) defined?

Honestly, I don’t know why your /etc/passwd and /etc/group only have a couple of entries (your user ID and group are there, right)? Mine work fine and contain entries. /etc is writable in Aurora.

wc -l /etc/passwd gives 7

wc -l /usr/etc/passwd gives 5

I didn’t say that things aren’t working fine but like to understand where all the other users are defined.

I found it. All the missing users are defined in /usr/lib/passwdand the missing groups in /usr/lib/group

1 Like

I had no idea they were doing that (moved them). thanks!

groups are in /usr/lib/groups.

This is how the dx-group recipe handles that

1 Like

Me neither. But when one has only 7 entries in /etc/passwd one thinks twice. I am happy I found it.

Now I try to understand how, for instance, passwd gets information from both /etc/passwd and /usr/lib/passwd

nss comes into my mind and looking into /etc/authselect/nsswitch.conf I see

passwd: files altfiles systemd
…
shadow: files systemd
group: files [SUCCESS=merge] altfiles [SUCCESS=merge] systemd

This helps a bit. altfiles seems to be important. The next question is where altfiles is defined.

Not yet looked into details but it seems that things are managed by package authselect-libs