# noexec and other unwanted options added to NFS mount

## nitro322

I having a weird problem with NFS.  First, here's my fstab line:

```
nas:/   /home/user/data   nfs4   user,exec,rw,sec=sys,bg,intr,proto=tcp,port=2049,rsize=32768,wsize=32768,timeo=14   0 0
```

This, combined with nfsmount, auto-mounts an NFSv4 share on my NAS under my user's home directory.  I've used that string of options for a few years now and it's worked fine.

I just did a clean install on a new computer, though, and I'm getting some unexpected behavior from NFS.  If I manually mount that share as my user, I get (most of) the mount options I'd expect:

```
$ mount | grep nas

nas:/ on /home/user/data type nfs4 (rw,nosuid,nodev,sec=sys,bg,intr,proto=tcp,port=2049,rsize=32768,wsize=32768,timeo=14,addr=192.168.0.2,clientaddr=192.168.0.3,user=user)
```

I'm not sure why nosuid and nodev are thrown in there, but it does everything I need.  However, if I manually mount that share as root, and when it's auto-mounted on boot, I get these options instead:

```
$ mount | grep nas

nas:/ on /home/user/data type nfs4 (rw,nosuid,nodev,noexec,sec=sys,bg,intr,proto=tcp,port=2049,rsize=32768,wsize=32768,timeo=14,addr=192.168.0.2,clientaddr=192.168.0.3,user)
```

This time, noexec is additionally added to the options, which is a problem because I need to execute files from that share.

A temporary workaround is to run:

sudo umount ~/data

mount ~/data

But this gets old, fast.  Does anyone know why noexec is being added to mount options when done as root and on boot?  And, more importantly, how to fix it?  I haven't been able to find any explanation for this yet, so any pointers would be most welcome.

Thanks.

----------

## Hu

Option user implies noexec:

```
       user   Allow an ordinary user to mount the filesystem.  The name of the

              mounting  user  is  written  to  mtab so that he can unmount the

              filesystem again.   This  option  implies  the  options  noexec,

              nosuid,  and  nodev (unless overridden by subsequent options, as

              in the option line user,exec,dev,suid).

```

I do not know why you are getting inconsistent results.  Could you explain why you specify user at all?  It seems unnecessary if the filesystem is boot mounted and network attached.

----------

## nitro322

Thanks, Hu.  Never noticed that implication before, so that at least explains part of it.  However, as mentioned in the man page, "unless overridden by subsequent options, as in the option line user,exec..."  So, since I'm explicitly setting exec in the option line after user as the documentation describes, noexec should not be enabled.  So, I'm still not sure why this doesn't work correctly.

The filesystem is automounted as a convenience, but there are times when I need to unmount/remount the share.  I'd like my unprivileged user account to have access to do so, hence the user option.

----------

## nitro322

Turns out this is a bug in the mount command.  This was introduced with the new libmount-based versions of the command included with util-linux 2.22, and fixed in 2.23.  Here's the fix:

https://github.com/karelzak/util-linux/commit/a4c0cc75ff9744299f108c259efab1bd30c8007a

I upgraded to util-linux-2.23-r2 (which also required and upgrade to sysvinit-2.88-r5), and now my NFS mount is behaving properly.  Documenting here in case anyone else runs into this problem.

----------

