/etc/exports
،المجلدات التي سيوفرها على الشبكة (المجلدات المُصدّرة exported). بالنسبة لكل مشاركة NFS، تمنح صلاحيات الوصول فقط للأجهزة المذكورة بجوارها. يمكن التحكم بالوصول بدقة أكبر باستخدام بضعة خيارات. صيغة الملف بسيطة جداً:
/directory/to/share machine1(option1,option2,...) machine2(...) ...
fsid=0
or fsid=root
.
*.falcot.com
أو مجال من عناوين IP مثل 192.168.0.0/255.255.255.0
أو 192.168.0.0/24
.
ro
). يمنح الخيار rw
صلاحيات القراءة والكتابة. يتصل عملاء NFS نموذجياً من منفذ مخصص للمستخدم الجذر (أي أنه أقل من 1024)؛ يمكن رفع هذا القيد باستخدام الخيار insecure
(الخيار secure
ضمني، لكن يمكن كتابته صراحة للتوضيح إذا اقتضت الحاجة).
sync
option); this can be disabled with the async
option. Asynchronous writes increase performance a bit, but they decrease reliability since there is a data loss risk in case of the server crashing between the acknowledgment of the write and the actual write on disk. Since the default value changed recently (as compared to the historical value of NFS), an explicit setting is recommended.
nobody
، وذلك في سبيل عدم منح صلاحيات الجذر على نظام الملفات لأي عميل NFS. هذا السلوك يوافق الخيار root_squash
، وهو مُفعّل افتراضياً. أما الخيار no_root_squash
، الذي يُعطّل هذا السلوك، فهو خطر ويجب استخدامه فقط في البيئات المسيطر عليها. يسمح الخياران anonuid=uid
وanongid=gid
بتحديد مستخدم زائف آخر لاستخدامه بدلاً من UID/GID 65534 (التي توافق المستخدم nobody
والمجموعة nogroup
).
sec
option to indicate the security level that you want: sec=sys
is the default with no special security features, sec=krb5
enables authentication only, sec=krb5i
adds integrity protection, and sec=krb5p
is the most complete level which includes privacy protection (with data encryption). For this to work you need a working Kerberos setup (that service is not covered by this book).
mount
والملف /etc/fstab
.
مثال 11.22. الربط اليدوي باستخدام الأمر mount
#
mount -t nfs4 -o rw,nosuid arrakis.internal.falcot.com:/shared /srv/shared
مثال 11.23. مدخلة NFS في الملف /etc/fstab
arrakis.internal.falcot.com:/shared /srv/shared nfs4 rw,nosuid 0 0
/shared/
NFS directory 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.