Configure a NFS Server


The /etc/exports file is the NFS server configuration file.   It controls which files and directories are exported, which host can access them, and what kind of access is allowed for them.....


   directory [host (option)].....


  The directory variable is the full path name of the directory or file being exported.   If the directory is not followed by a host or an option, all hosts are granted read/write access to the directory.


  The host variable is the name of the client granted access to the exported directory.   If no host value is specified, the directory is exported to everyone.   valid host values are the following:


  • Individual host names such as parrot.foobirds.org or vins.vinsky2002.net 
  • Domain wildcards such as *vinsky2002.net for every host in the vinsky2002.net domain
  • IP address/address mask pairs such as 172.16.5.0/255.255.255.0 for every host with an address that begins with 172.16.5. 
  • Net groups such as @group1.  a net group is a name assigned to a group of individual host in the /etc/netgroup file.   
  • They are primarily used on systems that run NIS

  

The Option variable defines the type of access being granted.   If the option is specified without a hostname, the access is granted to all clients.   Otherwise, the access is granted only to the host that is named.   The two(2) most common options are:


  • ro specifies that client may read only to the directory.   writing to the directory is not permitted
  • rw grants full read and write access to the directory.   Read/Write access is the default permission

  Listing 3.0  A sample /etc/exports file


  /usr       172.16.5.0/255.255.255.0(ro)

  /home    172.16.5.0/255.255.255.0(rw)

  /usr/local/man  flicker(rw) parrot(rw)

  /usr/local/doc  flicker(rw) parrot(rw)

  /usr/local/bin   hawk(rw)

  /home/sales   *.sales.foobirds.org(rw)