[systemd-devel] systemd-sysusers

Michael Chapman mike at very.puzzling.org
Mon Feb 5 09:47:35 UTC 2018

On Mon, 5 Feb 2018, Reindl Harald wrote:
> Am 05.02.2018 um 06:56 schrieb Michael Chapman:
>>  On Mon, 5 Feb 2018, Johannes Ernst wrote:
>>>  It appears systemd-sysusers does not create home directories. On the
>>>  other hand, it picks (largely unpredictable) UIDs from a range.
>>>  So I have to run systemd-sysusers, and after that, find the UID of the
>>>  user and chown the home directory? Or is there the equivalent of the
>>>  “useradd -m” flag somewhere that I’m just not seeing?
>>  systemd-sysusers is, as the name suggests, really for _system_ users, and
>>  often those kinds of users don't have ordinary home directories -- that
>>  is, ones the user can actually write to.
>>  However, systemd-sysusers.service is ordered before
>>  systemd-tmpfiles-setup.service at boot, so if you need to create a system
>>  user's home directory and ensure its ownership is correct, you could use a
>>  corresponding tmpfiles.d fragment to do so.
> i hope you meant systemd-tmpfiles-setup.service is ordered before 
> systemd-sysusers.service and you simply talked about "Before=" which in fact 
> means ordered after

Sorry, I cannot work out what you are saying.

Take a look at the unit files as shipped in systemd. 
systemd-tmpfiles-setup.service is ordered After=systemd-sysusers.service 
(which is, as far as I can tell, equivalent to what I said before). It 
needs to be that way around for a tmpfiles.d fragment to be able to 
reference a user created by systemd-sysusers.

More information about the systemd-devel mailing list