[Samba] smb.conf root preexec ?

niya niyalevi at gmail.com
Fri Jul 27 03:16:33 UTC 2018


> Re: [Samba] smb.conf root preexec ?.eml
>
> Subject:
> Re: [Samba] smb.conf root preexec ?
> From:
> Rowland Penny <rpenny at samba.org>
> Date:
> 25/07/2018 08:26
>
> To:
> samba at lists.samba.org
>
>
> 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
>
>
Hi Rowland

thanks for the quick reply
i've not given you enough information and sent you off in the wrong 
direction.
my os is archlinux , the dc will be a fresh install and no 
configurations have been set or scripts written yet.
no sssd just standard winbindd,
my intention is that when a new user logs in,
the dc via ssh will run a script or directly run the commands on the 
home dir fileserver which has a btrfs fs,
to create the btrfs subvolumes and mount them at the appropriate location ,
is there is a better way than using ssh maybe something internal to samba ?
on completion of that process the dc resumes the login process of the 
new user.
what would be the smb.conf and any other config commands to achieve this ?

shadrock




More information about the samba mailing list