-
Notifications
You must be signed in to change notification settings - Fork 32
Description
I tried out Homed and it turns out that the users it makes are "fake". What I mean is that they are not present in /etc/passwd by design. However, varlink can be used to discover them.
The basic principle is to query varlink for all the users on the system. Then, use some kind of filter similar to one used for /etc/passwd to only retain "human" users. If all of this fails, reach into /etc/passwd and try finding any users there. And, of course, the user can just type in their username if all this goes wrong.
Unfortunately, I am not exactly sure how to correctly tell a system user from a "human" user. It seems userdbctl does it incorrectly - infers "disposition": "regular" (meaning "human" users) for nixbld** users, who are not supposed to be labeled that. So, clearly, there is a fine edge where you can over-assume.
The user records are documented here:
https://systemd.io/USER_GROUP_API/
https://systemd.io/USER_RECORD/
The easiest way to view the user database is with userdbctl. Varlink can be queried directly like this:
varlinkctl --more call /run/systemd/userdb/io.systemd.Multiplexer io.systemd.UserDatabase.GetUserRecord '{"service": "io.systemd.Multiplexer"}'