LoginSignup
1
1

More than 3 years have passed since last update.

nfs時にaccess denied by server while mounting example.comが出た場合

Posted at

TL;DR

VirtualBoxでNFSを使う場合は/etc/exportsにinsecureをつける

現象

VirtualBoxの中からnfs mountを試みた時に以下のエラーがでた。

mount.nfs4: access denied by server while mounting example.com:/

その時のexportsは以下の通り。

/etc/exports
“/home/data” 192.168.10.0/24(rw,no_subtree_check,no_root_squash,fsid=0) 10.255.0.0/24 (rw,no_subtree_check,no_root_squash,fsid=0)

原因

nfsサーバーの/etc/exportsにsecureが付いている(default:secure)と1024以下のportのみしか許可しない。
VirtualBoxを使用している場合、ホストOS経由のnfs mountになる.ゲストOS側では1024以下のport番号であっても、NATになっている場合、ホストOSから出るパケットは1024より大きなport番号になることがある。
そのためaccess deniedとなる。

wiresharkでパケットをキャプチャすると、以下のエラーが出ていたため気づくことができた。

PUTROOTFH | GETATTR Status: NFS4ERR_PERM

対策

/etc/exportsにinsecureをつける。
1024以上のport開けるのも嫌だが、他の解決方法が現在思いついていない。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1