mount.nfs: access denied by server while mounting

Solution 1:

Found it!

One of the logs had the line:

refused mount request from 192.168.1.108 for /home/me (/home/me): illegal port 64112

I googled and found that since the port is over 1024 I needed to add the "insecure" option to the relevant line in /etc/exports on the server. Once I did that (and ran exportfs -r), the mount -a on the client worked.

Solution 2:

This question is related on how the network is set for your vm.

By default with VirtualBox, you have NAT network. Which result in port translation.

Step by step this gives :

  1. The NFS client is using a reserved port (<1024 ... that can only be opened by root -> secured)
  2. Virtualbox does the port translation (NAT) -> client port is now greater than 1024
  3. The NFS server refuses the connection for that insecure port.

As mentioned by @JoelFan, one fix would be to set the insecure option to the server. This is a quick fix but ... insecure ;)

What fixed the case for me (in a secured manner) was to change from NAT to Bridge network for this vm. This way, my vm has it's own IP address and no port translation is done.

Solution 3:

Guess what... for me, the source of exactly the same error was a version mismatch between my NFS client and the server.

The logs were silent as if nothing happened, and only nfswatch running on the server side helped me clarify the situation.

The problem was resolved by adding the nfsver mount option on the client side:

server:/path   /mount/point   nfs   nfsvers=3   0 0

Solution 4:

Have you verified that the name resolution is correct on the server for the client that is trying to connect (and is listed in the exports file)?