Exporting NFS Filesystems

The /etc/exports file controls what filesystems you wish to export. Its format is as follows:

directory       hostname(options)

The (options) are not required. For example:

/mnt/export     speedy.redhat.com

would allow users from speedy.redhat.com to mount /mnt/export with the default read-only permissions, but:

/mnt/export     speedy.redhat.com(rw)

would allow users from speedy.redhat.com to mount /mnt/export with read-write priviledges.

CautionCaution
 

Be careful with spaces in the /etc/exports file. If there are no spaces between the hostname and the options in parentheses, the options apply only to the hostname. If there is a space between the hostname and the options, the options apply to the rest of the world. For example, examine the following lines:

/mnt/export speedy.redhat.com(rw)
/mnt/export speedy.redhat.com (rw)

The first line grants users from speedy.redhat.com read-write access and denies all other users. The second line grants users from speedy.redhat.com read-only access (the default) and allows the rest of the world read-write access.

Refer to the Official Red Hat Linux Reference Guide for a list of options that can be specified in the /etc/exports file.

Each time you change /etc/exports, you must tell the NFS daemons to examine it for new information, or reload the configuration file:

/sbin/service nfs reload

Starting and Stopping the Server

On the server that is exporting NFS filesystems, the nfs service must be running.

View the status of the NFS daemon with the command

/sbin/service nfs status

Start the NFS daemon with the command

/sbin/service nfs start

Stop the NFS daemon with the command

/sbin/service nfs stop

To start the nfs service at boot time, use the command:

/sbin/chkconfig --level 345 nfs on

You can also use ntsysv or serviceconf to configure which services start at boot time. Refer to Chapter 8 for details.