Friday, November 22, 2013

Linux NFS Server Configuation

Linux NFS Server Configuation

NFS Server Configuration File

The /etc/exports file controls which file systems are exported to remote hosts and specifies options. Blank lines are ignored, comments can be made by starting a line with the hash mark (#), and long lines can be wrapped with a backslash (\). Each exported file system should be on its own individual line, and any lists of authorized hosts placed after an exported file system must be separated by space characters. Options for each of the hosts must be placed in parentheses directly after the host identifier, without any spaces separating the host and the first parenthesis.
A line for an exported file system has the following structure:
<export> <host1>(<options>) <hostN>(<options>)...

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 frombob.example.com to mount the directory read-only (the default), but the rest of the world can mount it read/write.

Starting and Stopping NFS

To run an NFS server, the portmap service must be running. To verify that portmap is active, type the following command as root:
# /sbin/service portmap status
To stop the server, as root type:
# /sbin/service nfs stop

The restart option is a shorthand way of stopping and then starting NFS. This is the most efficient way to make configuration changes take effect after editing the configuration file for NFS.
To restart the server, as root type:
# /sbin/service nfs restart
The condrestart (conditional restart) option only starts nfs if it is currently running. This option is useful for scripts, because it does not start the daemon if it is not running. 
To conditionally restart the server, as root type:
# /sbin/service nfs condrestart

To reload the NFS server configuration file without restarting the service, as root type:
# /sbin/service nfs reload

No comments:

Post a Comment

  How to Change Instance Type & Security Group of EC2 in AWS By David Taylor Updated April 29, 2023 EC2 stands for Elastic Compute Cloud...