Preexec and multiple commands

Steve Litt slitt at troubleshooters.com
Tue Oct 19 18:45:04 GMT 1999


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:

[homes]
read only=yes
valid users=%U
write list=%U
root preexec=mkdir 0770 /home/%U/smbhome & chown %U:%U /home/%U/smbhome &
path=/home/%U/smbhome
browseable=no
                                 

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

At 04:22 AM 10/20/1999 +1000, you wrote:
>Hi,
>
>I am trying to create two directories using the preexec command but I must
>be missing something very simple. I just can´t figure out the syntax. How
>would I continue this so that I could create dir2?
>
>preexec = if [ ! -e /home/%U/dir1] then /bin/mkdir /home/%U/dir1; fi
>
>Regards
>
>Robert
>----------------------------------------------------------
>
>



More information about the samba mailing list