[systemd-devel] mkosi.postinst and user home permissions

Federico Bruni fede at inventati.org
Mon Jul 10 08:58:23 UTC 2017



Il giorno lun 10 lug 2017 alle 10:46, Lennart Poettering 
<lennart at poettering.net> ha scritto:
> On Tue, 04.07.17 12:28, Federico Bruni (fede at inventati.org) wrote:
> 
>>  I'm building fedora-26 in a directory.
>>  I want to add a normal user, so I've added to mkosi.postinst:
>> 
>>  useradd dev -p mypassword
>>  usermod dev -a -G wheel
>> 
>>  These two commands work fine, but the permissions are not correct:
>> 
>>  # ls -l /home/
>>  total 4
>>  drwxrwxr-x 2 root root 4096 Jul  3 18:13 dev
>> 
>>  Is this a bug? Or maybe what I'm trying to do should be 
>> accomplished in
>>  another way?
>>  As a workaround, I might try add a third line to mkosi.postinst:
> 
> Uh, this appears very strange to me, this feels like a bug in
> "useradd" indeed. I have no idea why the directory isn#t created
> properly...
> 

I guess you missed my follow-ups in this thread.
The problem was caused by a file (.bashrc) I placed in 
mkosi.extra/home/dev.
My understanding is that mkosi first copied that file, then run the 
postinst script containing the useradd command, which failed 
(correctly) as /home/dev already existed.

I've moved the file to mkosi.extra/etc/skel and now everything works 
fine.





More information about the systemd-devel mailing list