xref: /openbsd/sbin/mountd/exports.5 (revision fc61954a)
1.\"	$OpenBSD: exports.5,v 1.23 2016/01/08 20:26:54 zhuk Exp $
2.\"	$NetBSD: exports.5,v 1.9 1996/02/18 11:57:50 fvdl Exp $
3.\"
4.\" Copyright (c) 1989, 1991, 1993
5.\"	The Regents of the University of California.  All rights reserved.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\" 1. Redistributions of source code must retain the above copyright
11.\"    notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\"    notice, this list of conditions and the following disclaimer in the
14.\"    documentation and/or other materials provided with the distribution.
15.\" 3. Neither the name of the University nor the names of its contributors
16.\"    may be used to endorse or promote products derived from this software
17.\"    without specific prior written permission.
18.\"
19.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29.\" SUCH DAMAGE.
30.\"
31.\"     @(#)exports.5	8.3 (Berkeley) 3/29/95
32.\"
33.Dd $Mdocdate: January 8 2016 $
34.Dt EXPORTS 5
35.Os
36.Sh NAME
37.Nm exports
38.Nd define remote mount points for NFS mount requests
39.Sh DESCRIPTION
40The
41.Nm
42file specifies remote mount points for the NFS
43mount protocol per the NFS server specification; see
44.%T "Network File System Protocol Specification" ,
45RFC 1094, Appendix A and
46.%T "NFS: Network File System Version 3 Specification" ,
47RFC 1813, Appendix I.
48.Pp
49Each line in the file
50(other than comment lines that begin with a
51.Dq # )
52specifies the mount point(s) and export flags within one local server
53filesystem for one or more hosts.
54A host may be specified only once for each local filesystem on the
55server and there may be only one default entry for each server
56filesystem that applies to all other hosts.
57The latter exports the filesystem to the
58.Dq world
59and should
60be used only when the filesystem contains public information.
61.Pp
62In a mount entry,
63the first field(s) specify the directory path(s) within a server filesystem
64that can be mounted on by the corresponding client(s).
65There are two forms of this specification.
66The first is to list all mount points as absolute
67directory paths separated by whitespace.
68The second is to specify the pathname of the root of the filesystem
69followed by the
70.Fl alldirs
71flag;
72this form allows the host(s) to mount at any point within the filesystem,
73including regular files.
74The pathnames must not have any symbolic links in them and should not have
75any
76.Dq \&.
77or
78.Dq \&.\&.
79components.
80Mount points for a filesystem may appear on multiple lines each with
81different sets of hosts and export options.
82.Pp
83The second component of a line specifies how the filesystem is to be
84exported to the host set.
85The option flags specify whether the filesystem
86is exported read-only or read-write and how the client UID is mapped to
87user credentials on the server.
88.Pp
89Export options are specified as follows:
90.Pp
91.Sm off
92.Fl maproot No = Ar user
93.Sm on
94The credential of the specified user is used for remote access by root.
95The credential includes all the groups to which the user is a member
96on the local machine (see
97.Xr id 1 ) .
98The
99.Ar user
100may be specified by name or number.
101.Pp
102.Sm off
103.Fl maproot No = Ar user:group1:group2:...
104.Sm on
105The colon separated list is used to specify the precise credential
106to be used for remote access by root.
107The elements of the list may be either names or numbers.
108Note that user: should be used to distinguish a credential containing
109no groups from a complete credential for that user.
110.Pp
111.Sm off
112.Fl mapall No = Ar user
113.Sm on
114or
115.Sm off
116.Fl mapall No = Ar user:group1:group2:...
117.Sm on
118Specifies a mapping for all client UIDs (including root)
119using the same semantics as
120.Fl maproot .
121.Pp
122The option
123.Fl r
124is a synonym for
125.Fl maproot
126in an effort to be backward compatible with older export file formats.
127.Pp
128In the absence of
129.Fl maproot
130and
131.Fl mapall
132options, remote accesses by root will result in using a credential of -2:-2.
133All other users will be mapped to their remote credential.
134If a
135.Fl maproot
136option is given,
137remote access by root will be mapped to that credential instead of -2:-2.
138If a
139.Fl mapall
140option is given,
141all users (including root) will be mapped to that credential in
142place of their own.
143.Pp
144The
145.Fl ro
146option specifies that the filesystem should be exported read-only
147(default read/write).
148The option
149.Fl o
150is a synonym for
151.Fl ro
152in an effort to be backward compatible with older export file formats.
153.Pp
154The third component of a line specifies the host set to which the line applies.
155The set may be specified in three ways.
156The first way is to list the host name(s) separated by whitespace.
157(Standard internet
158.Dq dot
159addresses may be used in place of names.)
160The second way is to specify a
161.Dq netgroup
162as defined in the netgroup file (see
163.Xr netgroup 5 ) .
164The third way is to specify an internet subnetwork using a network and
165network mask that is defined as the set of all hosts with addresses within
166the subnetwork.
167This latter approach requires less overhead within the
168kernel and is recommended for cases where the export line refers to a
169large number of clients within an administrative subnet.
170.Pp
171The first two cases are specified by simply listing the name(s) separated
172by whitespace.
173All names are checked to see if they are
174.Dq netgroup
175names
176first and are assumed to be hostnames otherwise.
177Using the full domain specification for a hostname can normally
178circumvent the problem of a host that has the same name as a netgroup.
179The third case is specified by the flag
180.Sm off
181.Fl network No = Ar netname
182.Sm on
183and optionally
184.Sm off
185.Fl mask No = Ar netmask .
186.Sm on
187If the mask is not specified, it will default to the mask for that network
188class (A, B or C; see
189.Xr inet_addr 3 ) .
190.Pp
191For example:
192.Bd -literal -offset indent
193/usr /usr/local -maproot=0:10 friends
194/usr -maproot=daemon grumpy.cis.uoguelph.ca 131.104.48.16
195/usr -ro -mapall=nobody
196/u -maproot=bin: -network=131.104.48 -mask=255.255.255.0
197/u2 -maproot=root friends
198/u2 -alldirs -network=cis-net -mask=cis-mask
199.Ed
200.Pp
201Given that
202.Pa /usr ,
203.Pa /u
204and
205.Pa /u2
206are
207local filesystem mount points, the above example specifies the following:
208.Pa /usr
209is exported to hosts
210.Em friends
211where
212.Em friends
213is specified in the netgroup file
214with users mapped to their remote credentials and
215root mapped to UID 0 and GID 10.
216It is exported read-write and the hosts in
217.Dq friends
218can mount either
219.Pa /usr
220or
221.Pa /usr/local .
222It is exported to
223.Em 131.104.48.16
224and
225.Em grumpy.cis.uoguelph.ca
226with users mapped to their remote credentials and
227root mapped to the user and groups associated with
228.Dq daemon ;
229it is exported to the rest of the world as read-only with
230all users mapped to the user and groups associated with
231.Dq nobody .
232.Pp
233.Pa /u
234is exported to all hosts on the subnetwork
235.Em 131.104.48
236with root mapped to the UID for
237.Dq bin
238and with no group access.
239.Pp
240.Pa /u2
241is exported to the hosts in
242.Dq friends
243with root mapped to UID and groups
244associated with
245.Dq root ;
246it is exported to all hosts on network
247.Dq cis-net
248allowing mounts at any
249directory within /u2.
250.Sh FILES
251.Bl -tag -width /etc/exports -compact
252.It Pa /etc/exports
253default remote mount-point file
254.El
255.Sh SEE ALSO
256.Xr netgroup 5 ,
257.Xr mountd 8 ,
258.Xr nfsd 8 ,
259.Xr showmount 8
260.Sh BUGS
261The export options are tied to the local mount points in the kernel and
262must be non-contradictory for any exported subdirectory of the local
263server mount point.
264It is recommended that all exported directories within the same server
265filesystem be specified on adjacent lines going down the tree.
266You cannot specify a hostname that is also the name of a netgroup.
267Specifying the full domain specification for a hostname can normally
268circumvent the problem.
269.Pp
270Regarding
271.Fl alldirs ,
272because NFS mount filehandles are filesystem wide the
273.Fl alldirs
274option applies to exports of the entire filesystem -- even mountpoints
275that are higher up elsewhere in the directory hierarchy.
276Hence if the server has a filesystem
277.Pa /export
278and you wished to export the sub-directory
279.Bd -literal -offset indent
280/export/root/client -alldirs client.foo.com
281.Ed
282.Pp
283you must realize that this also allows mounts to be requested
284against other locations in the
285.Pa /export
286filesystem; thus the host client.foo.com is also permitted to
287mount the directory
288.Pa /export/root/client2
289if it exists.
290