/etc/exports and /etc/exports.d/, lists the directories that are made available over the network (exported). For each NFS share, only the given list of machines is granted access. More fine-grained access control can be obtained with a few options. The syntax for this file is quite simple:
/directory/to/share machine1(option1,option2,...) machine2(...) ...
fsid=0 または fsid=root で識別されなければいけません。これらの点に注意してください。
*.falcot.com などの構文を使うか 192.168.0.0/255.255.255.0 や 192.168.0.0/24 などの IP アドレス範囲を使います。
ro オプションを使えば) 読み込み専用として利用できるようにされます。rw オプションを使えば読み書きアクセスが許可されます。典型的に NFS クライアントは root だけが使えるポート (言い換えれば、1024 番よりも低い番号のポート) から接続します。高いポート番号を使うクライアントからの接続を受け入れるには、insecure オプションを使います (secure オプションは暗黙的に有効化されていますが、明示する必要があればオプションを明示することも可能です)。
sync オプション) 後です。これを無効化するには、async オプションを使います。非同期書き込みを使うことで、性能はほんの少し向上しますが、信頼性は低下します。なぜなら、書き込み確認とディスクへの実際の書き込みの間にサーバがクラッシュした場合に、データを損失する危険性があるからです。デフォルト値が sync に変更されたのは最近なので (NFS バージョンによってデフォルト値が違うので)、明確に sync オプションを設定することを推奨します。
nobody user. This behavior corresponds to the root_squash option, and is enabled by default. The no_root_squash option, which disables this behavior, is risky and should only be used in controlled environments. If all users should be mapped to the user nobody, use all_squash. The anonuid=uid and anongid=gid options allow specifying another fake user to be used instead of UID/GID 65534 (which corresponds to user nobody and group nogroup).
sec オプションを追加してセキュリティレベルを指定することが可能です。デフォルト設定の sec=sys は特別なセキュリティ機能を有効化しません。sec=krb5 は認証機能だけを有効化します。sec=krb5i は認証と整合性保護機能を有効化します。sec=krb5p はすべての機能、すなわち認証、整合性保護、プライバシー保護機能 (データ暗号化機能を含みます) を有効化します。これらを使うには、Kerberos サービスを動作させる必要があります (Kerberos サービスについては本書で解説されていません)。
mount command and the /etc/fstab file.
例 11.20 /etc/fstab ファイルの NFS エントリ
arrakis.internal.falcot.com:/shared /srv/shared nfs4 rw,nosuid 0 0
/shared/ from the arrakis server into the local /srv/shared/ directory. Read-write access is requested (hence the rw parameter). The nosuid option is a protection measure that wipes any setuid or setgid bit from programs stored on the share. If the NFS share is only meant to store documents, another recommended option is noexec, which prevents executing programs stored on the share. Note that on the server, the shared directory is below the NFSv4 root export (for example /export/shared), it is not a top-level directory.