[Samba] how to use root preexec on user share with %U not as root user

Jelle de Jong jelledejong at powercraft.nl
Wed Apr 29 23:25:38 UTC 2020


Hello everybody,

I am trying to get samba 4 to make a user dir without the use of ADUC to 
set the homeDirectory, but with samba-tool user create only.

I created a root preexec but the %U is filled with root and not the 
username of the user.

I need to user [users] and not the old [homes] because I got a GPO for 
redirection to the //server/users/%USERNAME% and I need this folder to 
be created before the first logon of the user otherwise it seems to go bad.

[users]
     path = /srv/storage/users/
     read only = No
     root preexec = /usr/local/bin/samba-mkdir-home %U

PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin/
if [ ! -e /srv/storage/users/$1 ]; then
     mkdir /srv/storage/users/$1
     chown "$1":"domain user" /srv/storage/users/$1
fi

Kind regards,

Jelle de Jong



More information about the samba mailing list