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" ? -ipuy
> 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" ? > > -ipuy%U will be substituted within smb.conf, not your script. You could do something like preexec = /root/script %U in smb.conf, and then name=`getent passwd | grep $1 ... Will your users be able to create directories in /samba/test/ (this dir is group writable and owned by group mygroup?). Is it your intention that one user will be able to read/write/delete another user's files? ~ Daniel ----------------------------------------------------------------------- This message is the property of Time Inc. or its affiliates. It may be legally privileged and/or confidential and is intended only for the use of the addressee(s). No addressee should forward, print, copy, or otherwise reproduce this message in any manner that would allow it to be viewed by any individual not originally listed as a recipient. If the reader of this message is not the intended recipient, you are hereby notified that any unauthorized disclosure, dissemination, distribution, copying or the taking of any action in reliance on the information herein is strictly prohibited. If you have received this communication in error, please immediately notify the sender and delete this message. Thank you.
-----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-----