Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

NFS error access denied by server while mounting

📅 2017-Jul-03 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ error, mount, nfs ⬩ 📚 Archive

Problem

I wanted to share a directory that was on my local computer to a remote computer named medusa using NFS. I did the setup of the NFS server on my local computer and NFS client on the remote computer as described here. However, when I mounted the NFS share on the remote computer, I got this error:

$ sudo mount /mnt/my_nfs_share
mount.nfs: access denied by server while mounting my-local-computer:/path/i/shared

Solution

This turned out to be tricky one! The error message is quite a bit misleading because it turned out that the problem had nothing to do with access. Turns out this remote computer medusa had two Ethernet cards and thus two IP addresses. One of the IP addresses was set to the hostname medusa, but the NFS client was using the second IP address.

The solution was to add the second IP address 192.168.0.100 as an entry in the /etc/exports file:

/path/i/shared medusa(rw,sync,no_subtree_check)
/path/i/shared 192.168.0.100(rw,sync,no_subtree_check)

The rest of the steps I repeated as described in this post. Everything worked fine and I was able to mount the NFS share on the remote computer.

Reference: https://unix.stackexchange.com/questions/106122/

Tried with: Ubuntu 14.04


© 2023 Ashwin Nanjappa • All writing under CC BY-SA license • 🐘 Mastodon📧 Email