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 autofs5
and nfs-common
(the autofs is used to automatically mount/unmount the share as explained below). On the server, install nfs-kernel-server
.
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:
/nfs_shares 192.168.0.XX(rw,sync,no_subtree_check)
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:
mount /nfs_shares
On the client, create the directory where you will mount the share (e.g. /mnt/homeshare):
mkdir /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):
+auto.master
/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.
mount -t cifs -o guest //ntinstall...tld/superuser /mnt/cifs/superuser
. As for the permissions, the original looks like-rwxr-xr-x. 1 root root 41 Aug 19 06:28 /srv/superuser/script1.py
and the mounted one like-rwxr-xr-x. 1 root root 41 Aug 19 06:28 /mnt/cifs/superuser/script1.py
. I'm usingsamba-3.6.6-92.fc17.1.i686
for the server andcifs-utils-5.6-1.fc17.i686
for the client, along withkernel-PAE-3.5.2-1.fc17.i686
.