[Samba] preexec script problem

Buchan Milne bgmilne at obsidian.co.za
Wed May 12 15:56:06 GMT 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


|
| hi all
|
| i'm running into a little problem when using preexec scripts for the
creation
| of dir's on my samba server....
|
| script
| ---
| #! /bin/sh
| name=`getent passwd | grep %U | awk -F: '{print $5}'`
| mkdir /samba/test/"$name"
| ---
|
| snip of smb.conf
| ---
| [test]
|         path = /samba/test
|         preexec = /root/script
|         browseable = Yes
|         writeable = Yes
|         valid users = @mygroup
|         force group = @mygroup
|         create mask = 0770
|         force create mode = 770
| ---
|
| anyone have any idea why the dir is not created under "/samba/test" ?
|

Your users don't have permission to run the scrippt /root/script, and/or
they don't have permission to run create files in /samba/test (or both).

You could just do:

public=no
preexec = mkdir /samba/test %U

or, if you don't want arbitrary users to create arbitrary directories in
/samba/test, rather do:

root preexec = mkdir /samba/test/%U && chown %U:%G /samba/test/%U

(it's a waste writing an external script for something that fits into
samba's 256 character limit on configuration entries ...).

Regards,
Buchan

P.S. you should also consider using 'getent passwd $USER' instead of
'getent passwd|grep $USER', the former is faster, will only return one
entry, and won't return any incorrect entries ...

- --
Buchan Milne                      Senior Support Technician
Obsidian Systems                  http://www.obsidian.co.za
B.Eng                                RHCE (803004789010797)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFAokkVrJK6UGDSBKcRAgEgAJ4+4LzW0UHgQtOpHSo/v30bnEDNRACeNkEK
/BsCDKolQBWb9zxyjkancds=
=HOMD
-----END PGP SIGNATURE-----


More information about the samba mailing list