Preexec and smb.conf

Steve Litt slitt at
Wed Oct 20 13:37:42 GMT 1999

Robert -- why can't you just add a semicolon at the end after the fi, copy
and paste your statement as a second statement, with a differeent filename.

Also, given the complexity of the task, my preference would be to create a
script holding the sh code, and simply have

root preexec=/usr/local/samba/private/MakeTwoDirs

Also try 

preexec = ./MakeTwoDirs

Although like I said, I never got preexec to create directories.


At 06:38 PM 10/20/1999 +1000, Robert Jonsson wrote:
>Hi Steve,
>And thanks for your answer. Unfortunately it does not solve my problem.
>What I´m trying to do is to create two dirs using preexec in the same
>service. It works well as long as I´m only creating one directory, what I
>can´t figure out is how to create the second directory withing the same
>service. Eg. How would I continue after the last "fi" in the script to
>check for the second directory and create it if it does not exist? 
>preexec = if [ ! -e /home/%U/dir1] then /bin/mkdir /home/%U/dir1; fi 
>Robert -- I've always had to use root preexec to create directories, even 
>though the user seemingly has permission to create it.
>Here's my code to make [homes] refer to an smbhome below the home 
>directory, thus protecting the . files from Wacky Windows users:
>read only=yes 
>valid users=%U 
>write list=%U 
>root preexec=mkdir 0770 /home/%U/smbhome & chown %U:%U /home/%U/smbhome & 
>You'll notice I'm not as diligent as you about checking whether the 
>directory needs creation :-) You'll also notice I did the Red Hat centric 
>group named after the user, instead of using %G. Don't make the same mistake.
>Hope this helps.
>Steve Litt

More information about the samba mailing list