[Samba] can not get preexec option to run a script file

Edmundo Valle Neto edmundo.valle at terra.com.br
Wed Dec 27 23:16:33 GMT 2006


James A. Dinkel escreveu:
> I created a script in a file called HomeScript located at
> "/etc/samba/Scripts/".  Now I want to run this from preexec on the
> [homes] share.  This is all that is in the script right now, minus the
> dashed lines:
>
> ----------------------
> #!/bin/bash
> # Creating home directories
>
> mkdir --mode=700 /export/homes/%S
> ----------------------
>
> My preexec option looks like this:
>
> preexec = /etc/samba/Scripts/HomeScript
>
> Now if I put the mkdir command directly in the preexec line, then it
> works, but I want to add in checking for the existence of the directory
> and also some other commands and branches.  Anybody see what I am doing
> wrong?
>
> James Dinkel
>   

Are you using %S inside the script? Probably it wont know what %S is, 
you can pass a parameter like:

preexec = /etc/samba/Scripts/HomeScript %S

and inside the script:

mkdir --mode=700 /export/homes/$1

Another thing, preexec is executed as the user connecting to the share 
if the script needs root rights use root preexec instead.


Regards.

Edmundo Valle Neto





More information about the samba mailing list