[Samba] smb.conf root preexec ?

niya niyalevi at gmail.com
Wed Jul 25 01:58:29 UTC 2018


> Subject:
> Re: [Samba] Samba AD domain member and home directory creation
> From:
> Denis Cardon <dcardon at tranquil.it>
> Date:
> 09/02/2017 19:07
> To:
> Dario Lesca <d.lesca at solinos.it>, Samba List <samba at lists.samba.org>
>
> Hi Dario,
>
> > On a Centos 7 minimal fresh install I have follow this howto:
> >
> > http://www.hexblot.com/blog/centos-7-active-directory-and-samba
> >
> > and I have Joining to an Active Directory server without problem.
> >
> > The command "id administrator" work great, the home directory (/home/us
> > er at srl) is successfully created if I run "su - user" or "ssh
> > user at localhost" from a shell command.
> >
> > Ad this point I have add the [homes] session to smb.conf
> >
> >     [homes]
> >         comment = Home Directories
> >         browseable = No
> >         inherit acls = Yes
> >         read only = No
> >         valid users = %S %D%w%S
> >
> > an also this work fine, but only if I run before "su - user" or I
> > create manually the user's home directory.
> >
> > My question is:
> >
> >     There is some way to create automatically this home directory when
> >     the user access to it the first time via smbclient or another WinPC?
>
> you can add a "root preexec=/opt/create_home.sh " parameter [1] in the 
> share definition and create the home and set the owner/mask in the 
> shell script. As the name implies, it will execute the script as root 
> before giving access to the share to the user. I have not tested it 
> with selinux enabled though.
>
> Cheers,
>
> Denis 
Hi everyone
is root preexec the smb.conf parameter i need, to run a script that i 
will create, to setup a new users home directory,
i have looked at the user add parameter  but from what i read from the 
above quote preexec seems to be what i need.
when a new user tries to login i need samba to simply call a script which
create a btrfs subvolume on the fileserver sharing out the home dirs 
after which samba then continues and allows login.
shadrock



More information about the samba mailing list