Give files execute permission when copying to samba share

Hi

Does anyone know how to configure samba so that when you copy a file to a samba share it is automatically stored with execute permissions? Currently I have to change it manually every time I copy a driver or something and need to run it on another computer.

I'm sure there's a more elegant way to handle this (possibly even directly through some Samba config), but you could set a cron job to run a script on that directory every five minutes.

Something like...

#!/bin/bash
chmod +x /the/samba/directory/*

You could save as /opt/makexec.sh (make executable)

Then run

crontab -e

to open your list of jobs, and add

*/5 * * * * /opt/makexec.sh

And save.

Unless anyone else has another idea?

There's a video for this on youtube, done by the delightful Nixie Pixel. Shame she doesn't post any more.

Link: https://www.youtube.com/watch?v=-wUfzdiE4m8

I already have samba set up, I'd just like it to store files with execute permission on. But as far as I can tell it can't be done. Using the create mask option only effects files which are from a windows machine and on linux it won't set execute on the share unless it's already set on the original file.

Yeah it would probably just be easier to do it manually for the files I need it set to. Apart from keeping the disks awake this option wouldn't work for me as I use AUFS to pool disks for the share, and I've had issues in the past where changing the permissions for a directory causes the disks to be filled with duplicates.

Unfortunately unless you can get your hands on the source-code, anything else would just be a glorified cron job. Unless you wrote a thread to hook IO (not sure of specifics in Linux) and implement the function from there.
I'm no Linux wizard, but would "/the/samba/directory/*" not select all the files in the directory, rather than the directory itself?

Yeah, but the problem seems to be with changing the permissions of multiple files, or moving them. I'm not sure what the problem is but I think it tries to change which disk they're stored on and seems to just fill the disks sequentially. It doesn't make much sense as that's not how it's configured. Either way I'm just going to leave it alone because it's a total pain to try and fix when it happens. I could apply the permissions to the disks rather than the pool but that's also a pain and it's not really a good solution anyway.

I was hoping there was an option in the samba configuration to do this but after reading about it it seems like it can't be done as when a file is copied from linux to the share the permissions are preserved so it would have to have execute permission already. Oh well.

Thanks anyway.