"mount.nfs: access denied by server while mounting" エラーでマウントに失敗する
Environment
- Red Hat Enterprise Linux 10
- Red Hat Enterprise Linux 9
- Red Hat Enterprise Linux 8
- Red Hat Enterprise Linux 7
- NFS クライアント
Issue
mount.nfs: access denied by server while mountingエラーでマウントに失敗します。- 起動時に NFS エクスポートをマウントできません。
Resolution
-
NFS プロバイダーが RHEL の場合は、以下のように
/etc/exportsにinsecureオプションを含めます。# cat /etc/exports /path/to/export *(rw,sync,no_root_squash,insecure) -
次に、共有を再度エクスポートします。
# exportfs -rvf -
NFS クライアントから NFS エクスポートをマウントしてみます。
-
Mounting the nfs share from a RHEL NFS server giver error "mount.nfs: access denied by server while mounting" の解決策を参照し、共有が問題のクライアントにエクスポートされていることを確認してください。
注記:NFS サーバーで設定変更を行う前に、すべてのクライアントから共有をアンマウントする必要があります。そうしないと、共有が古くなります。
Root Cause
-
0-1024の範囲の TCP/UDP ポートは特権サービス用に予約されており、既知のポートとして指定されています。 -
以下のエラーは NFS サーバー側のログに記録されており、セキュアなポートが必要であることを示しています。
rpc.mountd[8111]: refused mount request from *.*.*.* for /path/to/export (/path/to/export): illegal port 21645
Diagnostic Steps
-
NFS サーバーは ping 可能であり、ポート
2049および111でtelnetを十個できる必要があります。 -
showmount -e <nfs server ip>コマンドを実行するとシステムが停止するかどうかを確認します。 -
showmount -e <nfs_server_ip>を実行すると、利用可能な共有がない (空白) という結果が返されますか?# showmount -e 1 <nfs-server-ip> Export list for <nfs-server-ip> -
理想的には、適切にエクスポートされていれば、以下のように共有とともに表示されるはずです。
# showmount -e <nfs-server-ip> Export list for <nfs-server-ip> /home ***.***.***.0/24 /export-1 ***.***.***.0/24 /export2 ***.***.***.0/24 -
共有が適切にエクスポートされているかどうかを確認するには、NFS サーバーの
/var/lib/nfs/etabを確認します。 -
rpcinfo -p <nfs_server_ip>コマンドは、登録されているすべての RPC プログラムのリストを表示します。必要なサービスに使用されているバージョン (v3、v4 など) があることを確認します。# rpcinfo -p <nfs_server_ip> program vers proto port service 100000 2 udp 111 portmapper 100000 2 tcp 111 portmapper 100000 3 udp 111 portmapper 100000 3 tcp 111 portmapper 100000 4 udp 111 portmapper 100000 4 tcp 111 portmapper 100003 3 udp 2049 nfs 100003 3 tcp 2049 nfs 100005 1 udp 635 mountd 100005 2 udp 635 mountd 100005 3 udp 635 mountd 100005 1 tcp 635 mountd 100005 2 tcp 635 mountd 100005 3 tcp 635 mountd 100021 4 udp 4045 nlockmgr 100021 4 tcp 4045 nlockmgr 100024 1 udp 4046 status 100024 1 tcp 4046 status -
パケットキャプチャー分析:
# tshark -tad -n -r client.pcap -Y 'frame.number == 500' -O rpc | sed '/^Re/,$ !d' Remote Procedure Call, Type:Reply XID:0x3f510e1b Fragment header: Last fragment, 20 bytes 1... .... .... .... .... .... .... .... = Last Fragment: Yes .000 0000 0000 0000 0000 0000 0001 0100 = Fragment Length: 20 XID: 0x3f510e1b (1062276635) Message Type: Reply (1) [Program: NFS (100003)] [Program Version: 4] [Procedure: COMPOUND (1)] Reply State: denied (1) [This is a reply to a request in frame 498] [Time from request: 0.000611000 seconds] Reject State: AUTH_ERROR (1) <===== Error Auth State: bad credential (seal broken) (1)nfs-serverは NFS クライアントを認証できません。
-
さらなるパケットキャプチャー分析:
# tshark -tad -nr client.pcap -Y nfs.status!=0 20 2018-12-18 13:46:46.377409 *.*.*.* → *.*.*.* NFS 144 V4 Reply (Call In 12) PUTROOTFH | GETATTR Status: NFS4ERR_PERMNFS4ERR_PERMエラーは、要求者が所有者ではないことを示します。呼び出し元が特権ユーザー (root) でも操作のターゲットの所有者でもないため、操作は許可されませんでした。
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Comments