Installation guide

Chapter 10. Network File System (NFS)
70
In this example 192.168.0.3 can mount /another/exported/directory/ read/write and all
writes to disk are asynchronous. For more information on exporting options, refer to man exportfs.
Additionally, other options are available where no default value is specified. These include the ability to
disable sub-tree checking, allow access from insecure ports, and allow insecure file locks (necessary
for certain early NFS client implementations). Refer to man exports for details on these less-used
options.
Warning
The format of the /etc/exports file is very precise, particularly in regards to use of the space
character. Remember to always separate exported file systems from hosts and hosts from one
another with a space character. However, there should be no other space characters in the file
except on comment lines.
For example, the following two lines do not mean the same thing:
/home bob.example.com(rw)
/home bob.example.com (rw)
The first line allows only users from bob.example.com read/write access to the /home
directory. The second line allows users from bob.example.com to mount the directory as read-
only (the default), while the rest of the world can mount it read/write.
10.6.2. The exportfs Command
Every file system being exported to remote users via NFS, as well as the access level for those
file systems, are listed in the /etc/exports file. When the nfs service starts, the /usr/sbin/
exportfs command launches and reads this file, passes control to rpc.mountd (if NFSv2 or
NFSv3) for the actual mounting process, then to rpc.nfsd where the file systems are then available
to remote users.
When issued manually, the /usr/sbin/exportfs command allows the root user to selectively
export or unexport directories without restarting the NFS service. When given the proper options, the
/usr/sbin/exportfs command writes the exported file systems to /var/lib/nfs/xtab. Since
rpc.mountd refers to the xtab file when deciding access privileges to a file system, changes to the
list of exported file systems take effect immediately.
The following is a list of commonly-used options available for /usr/sbin/exportfs:
-r
Causes all directories listed in /etc/exports to be exported by constructing a new export list in
/etc/lib/nfs/xtab. This option effectively refreshes the export list with any changes made to
/etc/exports.
-a
Causes all directories to be exported or unexported, depending on what other options are passed
to /usr/sbin/exportfs. If no other options are specified, /usr/sbin/exportfs exports all
file systems specified in /etc/exports.
-o file-systems
Specifies directories to be exported that are not listed in /etc/exports. Replace file-
systems with additional file systems to be exported. These file systems must be formatted in the