Network File Services  «Prev 

/etc/exports File 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. Valid host types are gss/krb5, gss/krb5i, and gss/krb5p. A line for an exported file system has the following structure:
< export> < host1> (< options> ) < hostN > (< options> )...
In this structure, replace <export> with the directory being exported, replace <host1> with the host or network to which the export is being shared, and replace <options> with the options for that host or network. Additional hosts can be specified in a space separated list. The following methods can be used to specify host names:
  1. single host: Where one particular host is specified with a fully qualified domain name, hostname, or IP address.
  2. wildcards: Where a * or ? character is used to take into account a grouping of fully qualified domain names that match a particular string of letters. Wildcards should not be used with IP addresses; however, it is possible for them to work accidentally if reverse DNS lookups fail. Be careful when using wildcards with fully qualified domain names, as they tend to be more exact than expected. For example, the use of *.example.com as a wildcard allows sales.example.com to access an exported file system, but not bob.sales.example.com. To match both possibilities both *.example.com and *.*.example.com must be specified.
  3. IP networks: Allows the matching of hosts based on their IP addresses within a larger network. For example, 192.168.0.0/28 allows the first 16 IP addresses, from 192.168.0.0 to 192.168.0.15, to access the exported file system, but not 192.168.0.16 and higher.
  4. netgroups: Permits an NIS netgroup name, written as @ <group-name> , to be used. This effectively puts the NIS server in charge of access control for this exported file system, where users can be added and removed from an NIS group without affecting /etc/exports.
In its simplest form, the /etc/exports file only specifies the exported directory and the hosts permitted to access it, as in the following example:

Red Hat Reference
Comments start with a hash #
1) Comments start with a hash #

exports mouse out
2) Comments start with a hash (#) mark and instruct NFS to ignore all text to the end of the line. The comment indicates that you are working with the /etc/exports file on the server compute.

The first field specifies the filesystem to export
3) The first field specifies the filesystem to export. In this case, NFS exports all files in the server's /projects filesystem.
WO
The second field lists the authorized hosts
4) The second field lists the authorized hosts and access methods for the filesystem in the first field. In this case, all hosts whose name starts with dev will gain read/write access. Hosts named dev1, developer, devnull, and devil will all match this specification and gain read/write access to /projects.

etc exports Redhat Linux
5) The first field specifies the filesystem to export. In this case, NFS exports all files in the server's /schedules filesystem.

The second field lists the authorized hosts
6) The second field lists the authorized hosts and access methods for the filesystem in the first field. In this case, two host match. First, any host named manager will gain read/write access to /schedules. Second, all hosts whose name starts with the dev will gain read only access host named dev1, developer, devnull and devil will all match this the specification and gain read only access to schedule.

etc exports Redhat Linux
7) The first field specifies the filesystem to export. in this case, NFS exports all files in the server's /user filesystem.

etc exports Redhat Linux
8) The second field lists the authorized hosts and access methods for the filesystem in the first field.
In this case no explicit host name is given. The NFS system interprets this as meaning all hosts so every host on the network gains readonly access to /user