Official Red Hat Linux Administrators Guide

Sharing files from an NFS server is known as exporting the directories. The NFS Server Configuration Tool can be used to configure a system as an NFS server. To use the NFS Server Configuration Tool, you must be running the X Window System. To start the application, select Main Menu Button (on the Panel) > Server Settings > NFS Server, or type redhat-config-nfs.

To add an NFS share, click the Add button. A dialog box will appear. The Basic tab requires the following information:

The General Options tab allows the following options to be configured:

The User Access tab allows the following options to be configured:

To edit an existing NFS share, select the share from the list, and click the Properties button. To delete an existing NFS share, select the share from the list, and click the Delete button. After you have finished adding, modifying, or deleting shares, the NFS service must be restarted. To apply the changes to the configuration file and restart the service, click the Apply button. If the NFS service is not already running, you will be prompted to start the service. Select Yes to start the daemon. The daemon must be running in order to export the configured directories. The old configuration file will be saved as /etc/exports.bak, and the new configuration will be written to /etc/exports.

NFS Server Configuration Tool reads and writes directly to the /etc/exports configuration file. Thus, the file can be modified manually after using the tool, and the tool can be used after modifying the file manually (provided the file was modified with correct syntax).

Command-Line Configuration

If you prefer editing configuration files using a text editor or if you do not have the X Window System installed, you can modify the configuration file directly. The /etc/exports file controls what directories the NFS server exports. Its format is as follows:

directory hostname(options)

The (options) component is not required. For example:

/misc/export speedy.redhat.com

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

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

would allow users from speedy.redhat.com to mount /misc/export with read-write privileges. Refer to the “Hostname Formats” section of this chapter for an explanation of possible hostname formats.

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:

/misc/export speedy.redhat.com(rw) /misc/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.

Each time you change /etc/exports, you must inform the NFS daemon of the change, or reload the configuration file with the following command:

/sbin/service nfs reload

Hostname Formats

The host(s) can be in the following forms:

Starting and Stopping the Server

On the server that is exporting NFS file systems, the NFS service must be running. View the status of the NFS daemon with the following command:

/sbin/service nfs status

Start the NFS daemon with the following command:

/sbin/service nfs start

Stop the NFS daemon with the following 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 chkconfig, ntsysv, or the Services Configuration Tool to configure which services start at boot time.

Категории