James A. Dinkel
2006-Dec-27 20:39 UTC
[Samba] can not get preexec option to run a script file
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
Edmundo Valle Neto
2006-Dec-27 23:44 UTC
[Samba] can not get preexec option to run a script file
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