The "mount.nfs: access denied by server" error typically occurs when the NFS server rejects the client's mount request. In this specific case, we have a working NFS setup between Ubuntu machines, but failure occurs when connecting from a VirtualBox guest on Windows.
Let's examine the critical components that could cause this behavior:
# Server's /etc/exports configuration (as provided):
/home/me *(rw,all_squash,async,no_subtree_check,anonuid=1000,anongid=1000)
The VirtualBox networking mode can affect NFS connectivity. Try these steps:
# Check the current network mode
VBoxManage showvminfo "VM Name" | grep "NIC"
Recommended modes for NFS:
- Bridged Adapter (best for direct network access)
- NAT with port forwarding (needs additional configuration)
NFS requires specific ports to be open. On the server, verify:
# Check NFS-related ports
sudo rpcinfo -p
# Typical NFS ports needed:
# 2049 (nfs)
# 111 (portmapper)
# Additional ports for mountd, nlockmgr, etc.
For VirtualBox guests, ensure these ports aren't blocked by Windows firewall.
The all_squash option with specific UID/GID requires matching:
# On client VM, check user mapping:
id username
If UID/GID don't match server's anonuid/anongid, consider:
# Alternative /etc/exports option:
/home/me *(rw,no_root_squash,async,no_subtree_check)
Try these VirtualBox-specific adjustments:
# 1. Enable promiscuous mode in network settings
VBoxManage modifyvm "VM Name" --nicpromisc1 allow-all
# 2. Verify the guest's network interface
ip addr show
Experiment with different mount parameters:
# Try simpler mount options first:
sudo mount -t nfs -o vers=3 myserver:/home/me /mnt/me
# Or force NFS version:
sudo mount -t nfs4 myserver:/home/me /mnt/me
If troubleshooting continues, enable verbose logging:
sudo mount -v -t nfs myserver:/home/me /mnt/me
Check server logs during mount attempts:
# Monitor NFS server logs in real-time
sudo tail -f /var/log/syslog | grep nfs
# Check export permissions
sudo exportfs -v
When dealing with NFS mounts between Ubuntu systems, the "access denied" error typically indicates a permissions mismatch between client and server configurations. The specific case where this fails on a VirtualBox-hosted Ubuntu client while working on physical machines suggests virtualization-related networking considerations.
First verify basic connectivity and NFS service status:
# Check NFS server status
sudo systemctl status nfs-kernel-server
# Verify RPC services
rpcinfo -p myserver
# Test raw mount from command line
sudo mount -t nfs -o rsize=8192,wsize=8192 myserver:/home/me /mnt/me
The critical difference in VirtualBox environments is often NAT vs Bridged networking:
# On VirtualBox guest:
ip addr show
ping myserver
traceroute myserver
# Compare with working physical client:
ssh working-client "ping -c 4 myserver"
The existing exports configuration:
/home/me *(rw,all_squash,async,no_subtree_check,anonuid=1000,anongid=1000)
Could be modified for VirtualBox-specific access:
/home/me 192.168.56.0/24(rw,sync,no_subtree_check) \
192.168.1.0/24(rw,sync,no_subtree_check)
After modifying /etc/exports, always run:
sudo exportfs -ra
sudo systemctl restart nfs-kernel-server
VirtualBox guests may have different firewall rules. Check with:
sudo ufw status
sudo iptables -L -n -v
Temporarily disable for testing:
sudo ufw disable
# Test mount
sudo ufw enable
Enable verbose logging on both ends:
# On server:
sudo rpcdebug -m nfsd -s all
sudo tail -f /var/log/syslog
# On client:
sudo rpcdebug -m nfs -s all
sudo mount -v -t nfs myserver:/home/me /mnt/me
If standard NFS continues to fail, consider these options:
# Try different mount options
sudo mount -t nfs -o \
rsize=8192,wsize=8192,soft,timeo=14,retrans=3 \
myserver:/home/me /mnt/me
# Test with vers=3 explicitly
sudo mount -t nfs -o vers=3 myserver:/home/me /mnt/me
# Or try vers=4.1 with minorversion
sudo mount -t nfs4 -o minorversion=1 myserver:/home/me /mnt/me