Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
noexec and other unwanted options added to NFS mount
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
nitro322
Guru
Guru


Joined: 24 Jul 2002
Posts: 596
Location: USA

PostPosted: Mon Dec 16, 2013 10:44 pm    Post subject: noexec and other unwanted options added to NFS mount Reply with quote

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

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

Code:
$ 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:

Code:
$ 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.
_________________
https://www.legroom.net/
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 23055

PostPosted: Mon Dec 16, 2013 11:42 pm    Post subject: Reply with quote

Option user implies noexec:
man mount:
       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.
Back to top
View user's profile Send private message
nitro322
Guru
Guru


Joined: 24 Jul 2002
Posts: 596
Location: USA

PostPosted: Tue Dec 17, 2013 6:38 am    Post subject: Reply with quote

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.
_________________
https://www.legroom.net/
Back to top
View user's profile Send private message
nitro322
Guru
Guru


Joined: 24 Jul 2002
Posts: 596
Location: USA

PostPosted: Mon Dec 23, 2013 7:39 pm    Post subject: Reply with quote

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.
_________________
https://www.legroom.net/
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum