Installation guide

Chapter 17. Network File System (NFS) 251
However, be careful when using wildcards with fully qualified domain names, as they tend to be
more exact than you would expect. For example, the use of *.domain.com as wildcard will al-
low sales.domain.com to access the exported file system, but not bob.sales.domain.com. To match
both possibilities, as well as sam.corp.domain.com, you would have to provide *.domain.com
*.*.domain.com.
IP networks Allows the matching of hosts based on their IP addresses within a larger net-
work. For example, 192.168.0.0/28 will allow the first 16 IP addresses, from 192.168.0.0 to
192.168.0.15, to access the exported file system but not 192.168.0.16 and higher.
netgroups — Permits an NIS netgroup name, written as @
group-name , to be used. This effec-
tively puts the NIS server in charge of access control for this exported file system, where users can
be added and removed from an NIS group without affecting /etc/exports.
Warning
The way in which the /etc/exports file is formatted is very important, particularly concerning the
use of space characters. 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 unless they are used in comment lines.
For example, the following two lines do not mean the same thing:
/home bob.domain.com(rw)
/home bob.domain.com (rw)
The first line allows only users from bob.domain.com read-write access to the /home directory.
The second line allows users from bob.domain.com to mount the directory read-only (the default),
but the rest of the world can mount it read-write. Be careful where space characters are used in
/etc/exports.
17.3. NFS Client Configuration Files
Any NFS share made available by a server can be mounted using various methods. Of course, the
share can be manually mounted, using themount command, to acquire the exported file system at a
particular mount point. However, this requires that the root user type the mount command every time
the system restarts. In addition, the root user must remember to unmount the file system when shutting
down the machine. Two methods of configuring NFS mounts include modifying the /etc/fstab or
using the autofs service.
17.3.1. /etc/fstab
Placing a properly formatted line in the /etc/fstab file has the same effect as manually mounting
the exported file system. The /etc/fstab file is read by the /etc/rc.d/init.d/netfs script at
system startup. The proper file system mounts, including NFS, are put into place.
A sample /etc/fstab line to mount an NFS export looks like the following:
server : /path/of/dir /local/mnt/point nfs options 0 0
The server-host relates to the hostname, IP address, or fully qualified domain name of the
server exporting the file system. The
/path/to/shared/directory tells the server what ex-
port to mount. The /local/mount/point specifies where on the local file system to mount the
exported directory. This mount point must exist before /etc/fstab is read or the mount will fail.
The nfs option specifies the type of file system being mounted.