[Samba] Can't get 'root preexec' to run

Rowland Penny rowlandpenny241155 at gmail.com
Wed Oct 21 11:15:54 UTC 2015


On 21/10/15 11:13, Ole Traupe wrote:
> Maybe I finally figured it out. I found that sentence
>
> "For example, the [test] and [homes] sections are unique disk shares; 
> they contain options that map to specific directories on the Samba 
> server."
>
> here:
>
> https://www.samba.org/samba/docs/using_samba/ch06.html
>
> Does that mean that this "preexec" in the [homes] section is not 
> invoked if the user is accessing his or her home dir that is 
> _configured_ on the DC ("known" by the DC), but only if the home dir 
> is actually _located/shared_ there under \\dc\homes?
>
> Seems logical now. :-/
>
> So I could put my preexec part under [netlogon], right?
>
>

OK, did some investigation here, I tried to connect to my home share on 
a machine running Linux MInt 17 from another machine running debian 
wheezy, I also created a simple script to echo something to /tmp. 
[homes] on the mint machine looks like this:

[homes]
    comment = Home Directories
    browseable = yes
    read only = no
    root preexec = /usr/local/scripts/welcome.sh %U

The script:

#!/bin/bash

SAMBAUSER=$1

echo "Welcome ${SAMBAUSER}" > /tmp/welcome.txt

exit 0

When I tried to browse to [homes], it showed in Caja, but would not let 
me enter to get to my home share and nothing appeared in /tmp

I changed [homes] to [home] , added the line 'path = /home', restarted 
everything and tried again, this time I could enter the 'home' share and 
the 'welcome.txt' file was created in /tmp.
I then changed 'browseable = yes' to 'browseable = no', removed the txt 
file in /tmp, restarted samba and then browsed directly to my home 
share, again it worked and the txt file was created in /tmp

HTH

Rowland



More information about the samba mailing list