NFS Server Configuration

There are three ways to configure an NFS server under Community Enterprise Linux: using the NFS Server Configuration Tool (system-config-nfs), manually editing its configuration file (/etc/exports), or using the /usr/sbin/exportfs command.

To use the NFS Server Configuration Tool, you must be running X Windows, have root privileges, and have the system-config-nfs RPM package installed. To start the application, click on System > Administration > Server Settings > NFS. You can also type the command system-config-nfs in a terminal. The NFS Server Configuration tool window is illustrated below.

NFS Server Configuration Tool

NFS Configuration Tool

Figure 20.1. NFS Server Configuration Tool


Based on certain firewall settings, you may need to configure the NFS daemon processes to use specific networking ports. The NFS server settings allows you to specify the ports for each process instead of using the random ports assigned by the portmapper. You can set the NFS Server settings by clicking on the Server Settings button. The figure below illustrates the NFS Server Settings window.

NFS Server Settings

NFS Server Settings

Figure 20.2. NFS Server Settings


Exporting or Sharing NFS File Systems

Sharing or serving 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 add an NFS share, click the Add button. The dialog box shown in appears.

The Basic tab requires the following information:

Add Share

Add NFS Share

Figure 20.3. Add Share


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

NFS General Options

General Options

Figure 20.4. NFS General Options


NFS User Access

User Access

Figure 20.5. NFS User Access


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 clicking OK to add, edit, or delete an NFS share from the list, the changes take place immediately - the server daemon is restarted and the old configuration file is saved as /etc/exports.bak. The new configuration is written to /etc/exports.

The 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).

The next this section discusses manually editing /etc/exports and using the /usr/sbin/exportfs command to export NFS file systems.

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 only option that needs to be specified is one of sync or async (sync is recommended). If sync is specified, the server does not reply to requests before the changes made by the request are written to the disk.

For example,

/misc/export speedy.example.com(sync)

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

/misc/export speedy.example.com(rw,sync)

would allow users from speedy.example.com to mount /misc/export with read/write privileges.

Refer to 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.example.com(rw,sync) /misc/export speedy.example.com (rw,sync)

The first line grants users from speedy.example.com read-write access and denies all other users. The second line grants users from speedy.example.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:

service nfs reload

Running NFS Behind a Firewall

Because NFS requires portmap, which dynamically assigns ports for RPC services and can cause problems for configuring firewall rules, you can edit the /etc/sysconfig/nfs configuration file to control which ports the required RPC services run on. Refer to and read for instructions on how to configure a firewall to allow NFS.

Hostname Formats

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