Preexec and smb.conf

Robert Jonsson robert.jonsson at
Wed Oct 20 08:34:09 GMT 1999

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