[Samba] User folder automatic creation - should use skel, but no

Paul De Vlieger paul.de_vlieger at moniut.univ-bpclermont.fr
Fri Jan 17 03:22:59 MST 2014


Le 17/01/2014 11:11, Márcio Merlone a écrit :
> Em 17-01-2014 05:48, Sven Schwedas escreveu:
>> Windows logon is completely separate from Unix logon and does not use
>> PAM at all. So yes, it's done by samba itself.
> Thanks for the info. Any known best practice to set this? I am looking at 
> 'root preexec' to create a new user's homedir.
>
> Regards.
>
Hi,
What I had to do to create a /home/%group%/%user%

in smb.conf share definition (%U for username ; %G for group)

    root preexec = /path/to/script/mksmbhome.sh %U %G

script content (don't forget a chmod+x)

    #!/bin/bash

    if [ ! -d /home/$2/$1 ]
    then
         mkdir /home/$2/$1
         cp -Rf /etc/skel-smb/* /home/$2/$1
         chown -R $1:$2 /home/$2/$1
         chmod -R g-rwx,o-rwx /home/$2/$1
    fi



More information about the samba mailing list