11

I have server (debian 6) machine (say, ip = 10.13.13.100) with nfs exports

/etc/exports

 /path/to/my/shared/folder 10.13.13.0/24(rw,async,no_sub_tree_check,no_root_squash)

There are two users on this machine admin (uid = 1000) and user (uid = 1001)

on client machines (also debian 6) (say, ip = 10.13.13.111) i have /etc/fstab

 10.13.13.100:/path/to/my/shared/folder /my/mount/point nfs rw,exec,user,owner 0 0

There is only one user (uid = 1000)

after reboot or mount -a, the shared folder is mounted successfully, but i can not execute any file on it (even if files have exec permissions). However, read and write for files on this file system works fine.

yakki
  • 123
  • 1
  • 1
  • 6

3 Answers3

16

The culprit is the user option you have used in /etc/fstab, and specifically that you have placed the exec option before the user option.

From man mount:

user: Allow an ordinary user to mount the filesystem. ... This option implies the options noexec, nosuid, and nodev (unless overridden by subsequent options, as in the option line user,exec,dev,suid).

I suppose this behaviour is for security reasons. Anyhow, whenever you use user, you should specifically add an exec option if that is what you want and it should be after the user option to override the noexec implied by user.

jamadagni
  • 261
  • 2
  • 4
  • `168.192.74.30:/volume1/nfs /mnt/nfs nfs defaults,user,exec,dev,suid 0 0` in my fstab and I can run .sh scripts from my nfs share again – Ahi Tuna Mar 16 '22 at 23:28
8

May be the noexec flag is set.

Brigo
  • 1,504
  • 11
  • 8
  • I have the `noexec` flag for my shared folder entry in /etc/mtab.. even if I remove the entry from mtab and than unmount and mount the shared folder, the `noexec` appears again.. Why? And how can i fix this??? – yakki Mar 18 '13 at 19:27
  • It is the default for nfs. You may add the exec option to change it. – Brigo Mar 18 '13 at 19:33
  • Should I add it to client:/etc/mtab? or server:/etc/exports? or client:/etc/fstab? – yakki Mar 18 '13 at 19:36
  • /etc/fstab, i think, but not really sure, sorry. :-) – Brigo Mar 18 '13 at 19:37
  • its already in fstab, and still does not work=( thanks anyway – yakki Mar 18 '13 at 19:42
1

I've fixed the issue by changing the client:/etc/fstab contents to the following:

10.13.13.100:/path/to/my/shared/folder /my/mount/point nfs rw,exec 0 0
Dave M
  • 4,494
  • 21
  • 30
  • 30
yakki
  • 123
  • 1
  • 1
  • 6