I would not use samba to connect two linux machines. Samba is designed to let linux/unix machines communicate with windows and vice versa. NFS is much better for two linux machines. You can probably tweak the samba settings to allow you to execute scripts, but you really will be better off using a native linux method. On my system, I have the same directory exported using samba (for the windows on my home network) and nfs for the linux and OSXes.
To export a directory using nfs, first, on both server and client, install
nfs-common (the autofs is used to automatically mount/unmount the share as explained below). On the server, install
Then (all these commands should be run as root):
Create the directory you will export, eg /nfs_shares:
sudo mkdir /nfs_shares
Set up the export rules. On the server, edit
/etc/exports and add these lines:
Where 192.168.0.XX is the client's (your Ubuntu Desktop) IP.
Mount (bind) the directory you will export to this new location. First add this line to /etc/fstab:
/path/to/exported/homeshare /nfs_shares bind bind 0
Then, mount it:
On the client, create the directory where you will mount the share (e.g. /mnt/homeshare):
At this point you should be able to manually mount the share. On the client:
mount -t nfs 192.168.0.XX:/nfs_shares/ /mnt/homeshare
Now, lets automate. On the client, create a file called /etc/auto.master with these lines (change SERVERNAME to whatever you want to call it):
/mnt/homeshare /etc/auto.SERVERNAME --timeout 60 --ghost
On the client, create a file called /etc/auto.SERVERNAME (change SERVERNAME to whatever you used in step 4) with these lines (you can use the server's network name or IP if static, change the XXs for whatever is your server's IP):
homeshare -rw,soft,intr,bg,rsize=8192,wsize=8192 192.168.XX.XX:/nfs_shares/homeshare
Run it! On the server, run
service nfs-kernel-server restart and on the client run
service nfs-common restart; service autofs restart
So, this makes it so the share is mounted automatically. If it is incative for one minute it will be unmounted and remounted as soon as you try to access it (eg
ls /mnt/homeshare). Make sure you set the permissions the way you need them (chmod) for the directories you use.