[Samba] smb.conf root preexec ?

Rowland Penny rpenny at samba.org
Wed Jul 25 07:26:05 UTC 2018


On Wed, 25 Jul 2018 02:58:29 +0100
niya via samba <samba at lists.samba.org> wrote:

> > 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
> 

No, that's oldschool, from reading the webpage you
referred to, I can see you have installed 'oddjob-mkhomedir', this
should do it for you. If the users homedirs are not being created at
user logon, then it is a red-hat problem, especially as you are also
using sssd.

Rowland



More information about the samba mailing list