/etc/exports
, enumera los directorios que estarán disponibles en la red (exportados). Para cada espacio compartido NFS, sólo tendrán acceso las máquinas especificadas. Puede obtener un control más detallado con unas pocas opciones. La sintaxis para este archivo es bastante simple:
/directorio/a/compartir maquina1(opcion1,opcion2,...) maquina2(...) ...
fsid=0
or fsid=root
.
*.falcot.com
o un rango de direcciones IP 192.168.0.0/255.255.255.0
o 192.168.0.0/24
.
ro
), los directorios están disponibles sólo para lectura. La opción rw
permite acceso de lectura y escritura. Los clientes NFS típicamente se conectan desde un puerto restringido sólo a root (en otras palabras, menor a 1024); puede eliminar esta restricción con la opción insecure
(la opción secure
es implícita, pero puede hacerla explícita para más claridad).
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
. Este comportamiento corresponde a la opción root_squash
y está activado de forma predeterminada. La opción no_root_squash
, que desactiva este comportamiento, es riesgosa y sólo debe ser utilizada en entornos controlados. Las opciones anonuid=uid
y anongid=gid
permiten especificar otro usuario falso que será utilizado en lugar deñ UID/GID 65534 (que corresponden al usuario nobody
y al grupo 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
y en el archivo /etc/fstab
.
Ejemplo 11.22. Montaje manual con el programa mount
#
mount -t nfs4 -o rw,nosuid arrakis.internal.falcot.com:/shared /srv/shared
Ejemplo 11.23. Elemento NFS en el archivo /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.