Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm trying to make my NFS server allow non-root mount requests.

Server: Debian Squeeze, kernel 2.6.32-5-686

What I have now: root (or sudoes) can mount NFS file systems, but regular users can't.

Why I think that it's possible at all:

  1. FreeBSD documentation: http://www.unix.com/man-page/FreeBSD/8/mountd/ option -n
  2. Questions on Linux oriented forums, like this: http://www.linuxquestions.org/questions/linux-software-2/non-root-account-unable-to-mount-a-nfs-connection-926985/

I. Debian server (

Installed packages: nfs-kernel-server, nfs-common, portmap

1) /etc/exports:


2) /var/lib/nfs/etab


3) Permissions to exported folders:

$ ls -lh -d /usr/appl
drwxr-xr-x 3 root root 4.0K Feb 25 17:16 /usr/appl
$ ls -lh -d /usr/private
drwxrwxrwx 4 root root 4.0K Feb 27 12:19 /usr/private

II. Ubuntu client (

Installed packages: nfs-common portmap

$ mount /mnt/nfs/appl
mount: only root can do that

In spite of there're user tag in /etc/fstab:    /mnt/nfs/appl      nfs   ro,async,nodev,nosuid,user  0   0 /mnt/nfs/private   nfs rw,rsize=8192,hard,intr,nfsvers=3,tcp,noatime,nodev,async,user 0  0

III. FreeBSD client (


$ cat /etc/rc.conf


$ mount /mnt/nfs/appl
[tcp] Permission denied
[tcp] Permission denied
[tcp] Permission denied

Interesting that just after press Enter it prints Permission denied, then waits some time, then trys to connect to, then prints Permission denied again. I know about connection to server 'cause I used tcpdump (tcpdump host on the server:

$ sudo tcpdump host
[sudo] password for sukharevd: 
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes
23:32:28.029560 ARP, Request who-has msiuioo.local tell, length 28
23:32:28.029598 ARP, Request who-has msiuioo.local tell, length 28
23:32:28.029661 ARP, Reply msiuioo.local is-at 00:21:85:51:44:02 (oui Unknown), length 28
23:32:28.031075 IP > msiuioo.local.sunrpc: UDP, length 56
23:32:28.031401 IP msiuioo.local.sunrpc > UDP, length 28
23:32:28.033275 IP > msiuioo.local.<b>nfs</b>: Flags [S], seq 4085518488, win     65535, options [mss 1460,nop,wscale 3,sackOK,TS val 405930 ecr 0], length 0
23:32:28.033326 IP msiuioo.local.nfs > Flags [S.], seq 1703965537, ack 4085518489, win 5792, options [mss 1460,sackOK,TS val 2186703 ecr 405930,nop,wscale 6], length 0
23:32:28.034717 IP > msiuioo.local.nfs: Flags [.], ack 1, win 8326, options [nop,nop,TS val 405930 ecr 2186703], length 0
23:32:28.034912 IP > msiuioo.local.<b>nfs</b>: 40 null
23:32:28.034978 IP msiuioo.local.nfs > Flags [.], ack 45, win 91, options [nop,nop,TS val 2186704 ecr 405930], length 0
23:32:28.035063 IP msiuioo.local.nfs > reply ok 24 null
23:32:28.036892 IP > msiuioo.local.nfs: Flags [F.], seq 45, ack 29, win 8326, options [nop,nop,TS val 405930 ecr 2186704], length 0
23:32:28.036986 IP msiuioo.local.nfs > Flags [F.], seq 29, ack 46, win 91, options [nop,nop,TS val 2186704 ecr 405930], length 0
23:32:28.039021 IP > msiuioo.local.nfs: Flags [.], ack 30, win 8325, options [nop,nop,TS val 405930 ecr 2186704], length 0
23:32:28.039124 IP > msiuioo.local.sunrpc: UDP, length 56
23:32:28.039426 IP msiuioo.local.sunrpc > UDP, length 28

Any suggestions?

UPD: Solved half of a problem. I should have used

mount /mnt/nfs/appl

instead of

mount /mnt/nfs/appl

on Linux (Ubuntu) client.

But still have problem with mounting in FreeBSD.

share|improve this question

1 Answer 1

The most likely reason you are having problems with non-root mounts is the "secure" export option, which is on by default. It disallows mount requests that come in with a source port greater than 1024. On most systems, binding to a port less than 1024 requires root access, so this is a fairly decent way of ensuring the mount was made by root.

The issue, as explained in the README for my NfSpy penetration testing tool, is that the NFS protocol (versions 2, 3, and even 4, without proper configuration) completely trusts the user ID sent in requests from client machines. By limiting requests to only those made by root, you limit your trust to only users on the client machine who have root access. Without this setting (using "insecure" in your exports file), any user can claim to have any UID and access any file on the export.

The reason it is working on Linux is probably because /bin/mount is setuid root:

~$ ls -l /bin/mount
-rwsr-xr-x 1 root root 72188 2011-01-20 13:54 /bin/mount

Just a hunch, but check the permissions on the mount binary on your FreeBSD system. If it is setuid, then you still have a problem, and I don't know what it is. If not, then that would explain what's going on.

Good luck with this, but please consider the security implications of allowing any user on a system to access any file on your server. I recommend using NFS4 with GSS authentication mechanisms instead of the traditional AUTH_SYS flavor.

share|improve this answer
I tried to add insecure option to /etc/exports and even change mod of /mnt/nfs/* directories to 777 but have no luck with FreeBSD. Anyway it's not required for FreeBSD, so I think what I have is enough for now. Thank you for note about GSS auth! –  Dmitriy Sukharev Mar 2 '12 at 19:25

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.