Permission Denied running python script from samba share

I'm trying to mount a samba share on a Ubuntu 12.04 desktop from a Fedora 17 desktop.

I can create, edit and delete files with no problem but when I try to run python scripts on the share i get a permission denied error.

I've tried mounting as root and using sudo with the following commands:

mount -t cifs //192.168.0.3/homeshare netbook -o user=james

mount -t cifs -o exec //192.168.0.3/homeshare netbook -o user=james

the file permissions have a . after them but i cant find out what that means

-rw-rw-r--. 1 james james 31804 Aug 14 18:20 cronlog.txt

-rwxrwxr-x. 1 james james   666 Aug 16 17:49 current.py

How can I mount this share in Fedora 17 and run scripts?


Solution 1:

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):

  1. Create the directory you will export, eg /nfs_shares:

    sudo mkdir /nfs_shares
    
  2. 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.

  3. 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
    
  4. 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
    
  5. 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
    
  6. 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
    
  7. 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.