.\" .\" Copyright (c) 1999-2007 Apple Inc. All rights reserved. .\" .\" @APPLE_LICENSE_HEADER_START@ .\" .\" This file contains Original Code and/or Modifications of Original Code .\" as defined in and that are subject to the Apple Public Source License .\" Version 2.0 (the 'License'). You may not use this file except in .\" compliance with the License. Please obtain a copy of the License at .\" http://www.opensource.apple.com/apsl/ and read it before using this .\" file. .\" .\" The Original Code and all software distributed under the License are .\" distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER .\" EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, .\" INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, .\" FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. .\" Please see the License for the specific language governing rights and .\" limitations under the License. .\" .\" @APPLE_LICENSE_HEADER_END@ .\" .\" Copyright (c) 1989, 1991, 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" @(#)exports.5 8.3 (Berkeley) 3/29/95 .\" .Dd October 25, 2006 .Dt EXPORTS 5 .Os .Sh NAME .Nm exports .Nd define remote mount points for .Tn NFS mount requests .Sh SYNOPSIS .Nm exports .Sh DESCRIPTION The .Nm exports file specifies remote mount points for the .Tn NFS mount protocol per the .Tn NFS server specification; see .%T "Network File System Protocol Specification \\*(tNRFC\\*(sP 1094, Appendix A" and .%T "NFS: Network File System Version 3 Specification, Appendix I" . .Pp Fields are separated by space or tab characters. Lines that begin with a # are considered comments and are ignored. .Pp Each line in the file specifies one or more exported directories, any additional mountable sub-directories within those directories, export flags, and one or more hosts (if access to the export is to be restricted). All directories on the line must exist within the same local file system. .Pp Within a file system there may be several exported sub-directories with different export options. However, none of those exported directories may lie within another. .Pp A host may be specified only once for each exported directory and there may be only one default entry for each exported directory that applies to all other hosts. The latter exports the file system to the ``world'' and should be used only when the file system contains public information. Any attempt to export the same directory to a host with different export options will cause the conflicting export entry to be rejected. .Pp The first field(s) of an export entry is a list of directories on a local file system to export. At least one pathname must be to an exported directory. Other pathnames may refer to sub-directories of the exported directory to indicate that hosts are also allowed to explicitly mount those sub-directories of the exported directory. (Note that the .Fl alldirs flag can be used to allow mounting any sub-directories of the pathnames specified.) .Pp Mount points for a file system may appear on multiple lines, each with different sets of hosts and export options. .Pp The pathnames must not have any symbolic links in them and should not have any "." or ".." components. Single and double quote characters occuring in a pathname must be escaped with \\' and \\", respectively. Space characters occuring in a pathname must be escaped, or alternatively, the pathname can be enclosed in single or double quotes. .Pp Note that because an export entry only lists a set of pathnames, it is up to the NFS server to correctly determine what file system is meant to be exported by that entry. To that end, the server will attempt to intelligently decide which file system best matches the entry by comparing all the pathnames with both the current list of mounted file systems and the list of previously-exported file systems. If the server determines that the intended file system is not available, it will automatically mark that export as offline until the file system becomes available (see the .Fl offline export option below for more info). To avoid any ambiguity, use of the .Fl fs export option is recommended (see below). .Pp The second component of a line specifies how the file system is to be exported to the host set. The option flags specify whether the file system is exported read-only or read-write and how the client uid is mapped to user credentials on the server. .Pp Export options are specified as follows: .Pp .Sm off .Fl maproot No = Sy user .Sm on The credential of the specified user is used for remote access by root. The credential includes all the groups to which the user is a member on the local machine ( see .Xr id 1 ). The user may be specified by name or number. .Pp .Sm off .Fl maproot No = Sy user:group1:group2:... .Sm on The colon separated list is used to specify the precise credential to be used for remote access by root. The elements of the list may be either names or numbers. Note that ``user:'' should be used to distinguish a credential containing no groups from a complete credential for that user. .Pp .Sm off .Fl mapall No = Sy user .Sm on or .Sm off .Fl mapall No = Sy user:group1:group2:... .Sm on specifies a mapping for all client uids (including root) using the same semantics as .Fl maproot . .Pp The option .Fl r is a synonym for .Fl maproot in an effort to be backward compatible with older export file formats. .Pp In the absence of .Fl maproot and .Fl mapall options, remote accesses by root will result in using a credential of -2:-2. All other users will be mapped to their remote credential. If a .Fl maproot option is given, remote access by root will be mapped to that credential instead of -2:-2. If a .Fl mapall option is given, all users (including root) will be mapped to that credential in place of their own. .Pp The .Fl alldirs flag allows the host(s) to mount at any point within the file system, including regular files if the .Fl R option is used on nfsd. .Pp The .Fl ro option specifies that the file system should be exported read-only (default read/write). The option .Fl o is a synonym for .Fl ro in an effort to be backward compatible with older export file formats. .Pp The .Fl 32bitclients option causes the NFS server to guarantee that directory cookies will fit within 32 bits even though directory cookies are 64 bits in NFSv3. This option may be required with NFS clients that do not properly support 64 bit directory cookies. Use of this option may result in sub-optimal performance of the exported file system. .Pp .Sm off .Fl sec No = Sy mechanism1:mechanism2... .Sm on This option specifies one or more security mechanisms required for access to the exported directory. The security mechanisms currently supported are krb5p, krb5i, krb5, and sys. Multiple security mechanisms can be specified as a colon separated list, and should be in the order of most preferred to least preferred. In the absence of this option, the security mechanism defaults to sys. .Pp .Sm off .Fl offline .Sm on This option specifies that the given export should be treated as if the exported file system is not available. For NFSv3, this will cause clients to receive "jukebox" errors directing them to try the request later. For NFSv2 (which does not support this error value), the export will be treated as non-existent and clients will receive stale file handle errors. .Pp .Sm off .Fl fspath No = Sy /path .Sm on and/or .Sm off .Fl fsuuid No = Sy UUID .Sm on These options can be used to specify the pathname to and/or the UUID of the file system that is intended to be exported. This can be useful to disambiguate the export entry. Since the export syntax only specifies the path to the directory to be exported, it can be ambiguous as to what file system is expected to be exported. Specifying "/Volumes/XRAID" can be interpreted as exporting either a file system mounted on that directory or the "Volumes/XRAID" subdirectory of the root file system. Specifying .Sm off .Fl fspath No = Sy /Volumes/XRAID .Sm on can prevent exporting the wrong file system - for example, if the exports are evaluated at a point when the directory exists but the volume has not yet been mounted on it. The export will fail if the file system referred to in an export entry either (1) is not mounted at the same path as the given .Sm off .Fl fspath No = Sy /path . .Sm on or (2) does not have a UUID that matches the given .Sm off .Fl fsuuid No = Sy UUID . .Sm on .Pp The third component of a line specifies the host set to which the line applies. The set may be specified in three ways. The first way is to list the host name(s) separated by white space. (Standard internet ``dot'' addresses may be used in place of names.) The second way is to specify a ``netgroup'' as defined in the netgroup file (see .Xr netgroup 5 ). The third way is to specify an internet sub-network using a network and network mask that is defined as the set of all hosts with addresses within the sub-network. This latter approach requires less overhead within the kernel and is recommended for cases where the export line refers to a large number of clients within an administrative sub-net. .Pp The first two cases are specified by simply listing the name(s) separated by whitespace. All names are checked to see if they are ``netgroup'' names first and are assumed to be hostnames otherwise. Using the full domain specification for a hostname can normally circumvent the problem of a host that has the same name as a netgroup. The third case is specified by the flag .Sm off .Fl network No = Sy netname .Sm on and optionally .Sm off .Fl mask No = Sy netmask . .Sm on If the mask is not specified, it will default to the mask for that network class (A, B or C; see .Xr inet 5 ). .Sh EXAMPLES .Bd -literal -offset indent /usr /usr/local -maproot=0:10 friends /usr -maproot=daemon grumpy.cis.uoguelph.ca 184.108.40.206 /usr -ro -mapall=nobody /u -maproot=bin: -network 131.104.48 -mask 255.255.255.0 /u2 -maproot=root friends /u2 -alldirs -network cis-net -mask cis-mask /Users -alldirs -network 220.127.116.11 -mask 255.255.255.0 /Applications -ro -network 18.104.22.168 -mask 255.255.255.0 .Ed .Pp Given that .Pa /usr , .Pa /u , .Pa /u2 , and .Pa / are local file system mount points, the above example specifies the following: .Pp .Pa /usr is exported to hosts .Ar friends , where .Ar friends is specified in the netgroup file with users mapped to their remote credentials and root mapped to uid 0 and group 10. It is exported read-write and the hosts in .Ar friends can mount either .Pa /usr or .Pa /usr/local . It is exported to .Em 22.214.171.124 and .Em grumpy.cis.uoguelph.ca with users mapped to their remote credentials and root mapped to the user and groups associated with ``daemon''; it is exported to the rest of the world as read-only with all users mapped to the user and groups associated with ``nobody''. .Pp .Pa /u is exported to all hosts on the sub-network .Em 131.104.48 with root mapped to the uid for ``bin'' and with no group access. .Pp .Pa /u2 is exported to the hosts in ``friends'' with root mapped to uid and groups associated with ``root''; it is exported to all hosts on network ``cis-net'' allowing mounts at any directory within /u2. .Pp The .Pa /Users and .Pa /Applications sub-directories of .Pa / are exported to all hosts on the sub-network .Em 2.29.96 . Any directory within .Pa /Users can be mounted. .Pa /Users is exported read-write and .Pa /Applications is exported read-only. .Sh FILES .Bl -tag -width /etc/exports -compact .It Pa /etc/exports The default remote mount-point file. .El .Sh SEE ALSO .Xr netgroup 5 , .Xr nfsd 8 , .Xr showmount 8 .Xr portmap 8 .Sh BUGS It is recommended that all exported directories within the same server file system be specified on adjacent lines going down the tree. You cannot specify a hostname that is also the name of a netgroup. Specifying the full domain specification for a hostname can normally circumvent the problem.