xref: /freebsd/usr.sbin/mountd/exports.5 (revision 7bd6fde3)
1.\" Copyright (c) 1989, 1991, 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\" 4. Neither the name of the University nor the names of its contributors
13.\"    may be used to endorse or promote products derived from this software
14.\"    without specific prior written permission.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26.\" SUCH DAMAGE.
27.\"
28.\"     @(#)exports.5	8.3 (Berkeley) 3/29/95
29.\" $FreeBSD$
30.\"
31.Dd March 29, 1995
32.Dt EXPORTS 5
33.Os
34.Sh NAME
35.Nm exports
36.Nd define remote mount points for
37.Tn NFS
38mount requests
39.Sh SYNOPSIS
40.Nm
41.Sh DESCRIPTION
42The
43.Nm
44file specifies remote mount points for the
45.Tn NFS
46mount protocol per the
47.Tn NFS
48server specification; see
49.%T "Network File System Protocol Specification" ,
50RFC1094, Appendix A and
51.%T "NFS: Network File System Version 3 Specification" ,
52Appendix I.
53.Pp
54Each line in the file
55(other than comment lines that begin with a #)
56specifies the mount point(s) and export flags within one local server
57file system for one or more hosts.
58A long line may be split over several lines by ending all but the
59last line with a backslash
60.Pq Ql \e .
61A host may be specified only once for each local file system on the
62server and there may be only one default entry for each server
63file system that applies to all other hosts.
64The latter exports the file system to the ``world'' and should
65be used only when the file system contains public information.
66.Pp
67In a mount entry,
68the first field(s) specify the directory path(s) within a server file system
69that can be mounted on by the corresponding client(s).
70There are two forms of this specification.
71The first is to list all mount points as absolute
72directory paths separated by whitespace.
73The second is to specify the pathname of the root of the file system
74followed by the
75.Fl alldirs
76flag;
77this form allows the host(s) to mount at any point within the file system,
78including regular files if the
79.Fl r
80option is used on
81.Xr mountd 8 .
82The pathnames must not have any symbolic links in them and should not have
83any "." or ".." components.
84Mount points for a file system may appear on multiple lines each with
85different sets of hosts and export options.
86.Pp
87The second component of a line specifies how the file system is to be
88exported to the host set.
89The option flags specify whether the file system
90is exported read-only or read-write and how the client uid is mapped to
91user credentials on the server.
92.Pp
93Export options are specified as follows:
94.Pp
95.Sm off
96.Fl maproot No = Sy user
97.Sm on
98The credential of the specified user is used for remote access by root.
99The credential includes all the groups to which the user is a member
100on the local machine (see
101.Xr id 1 ) .
102The user may be specified by name or number.
103.Pp
104.Sm off
105.Fl maproot No = Sy user:group1:group2:...
106.Sm on
107The colon separated list is used to specify the precise credential
108to be used for remote access by root.
109The elements of the list may be either names or numbers.
110Note that user: should be used to distinguish a credential containing
111no groups from a complete credential for that user.
112.Pp
113.Sm off
114.Fl mapall No = Sy user
115.Sm on
116or
117.Sm off
118.Fl mapall No = Sy user:group1:group2:...
119.Sm on
120specifies a mapping for all client uids (including root)
121using the same semantics as
122.Fl maproot .
123.Pp
124The option
125.Fl r
126is a synonym for
127.Fl maproot
128in an effort to be backward compatible with older export file formats.
129.Pp
130In the absence of
131.Fl maproot
132and
133.Fl mapall
134options, remote accesses by root will result in using a credential of -2:-2.
135All other users will be mapped to their remote credential.
136If a
137.Fl maproot
138option is given,
139remote access by root will be mapped to that credential instead of -2:-2.
140If a
141.Fl mapall
142option is given,
143all users (including root) will be mapped to that credential in
144place of their own.
145.Pp
146The
147.Fl ro
148option specifies that the file system should be exported read-only
149(default read/write).
150The option
151.Fl o
152is a synonym for
153.Fl ro
154in an effort to be backward compatible with older export file formats.
155.Pp
156.Tn WebNFS
157exports strictly according to the spec (RFC 2054 and RFC 2055) can
158be done with the
159.Fl public
160flag.
161However, this flag in itself allows r/w access to all files in
162the file system, not requiring reserved ports and not remapping uids.
163It
164is only provided to conform to the spec, and should normally not be used.
165For a
166.Tn WebNFS
167export,
168use the
169.Fl webnfs
170flag, which implies
171.Fl public ,
172.Sm off
173.Fl mapall No = Sy nobody
174.Sm on
175and
176.Fl ro .
177Note that only one file system can be
178.Tn WebNFS
179exported on a server.
180.Pp
181A
182.Sm off
183.Fl index No = Pa file
184.Sm on
185option can be used to specify a file whose handle will be returned if
186a directory is looked up using the public filehandle
187.Pq Tn WebNFS .
188This is to mimic the behavior of URLs.
189If no
190.Fl index
191option is specified, a directory filehandle will be returned as usual.
192The
193.Fl index
194option only makes sense in combination with the
195.Fl public
196or
197.Fl webnfs
198flags.
199.Pp
200Specifying the
201.Fl quiet
202option will inhibit some of the syslog diagnostics for bad lines in
203.Pa /etc/exports .
204This can be useful to avoid annoying error messages for known possible
205problems (see
206.Sx EXAMPLES
207below).
208.Pp
209The third component of a line specifies the host set to which the line applies.
210The set may be specified in three ways.
211The first way is to list the host name(s) separated by white space.
212(Standard Internet ``dot'' addresses may be used in place of names.)
213The second way is to specify a ``netgroup'' as defined in the netgroup file (see
214.Xr netgroup 5 ) .
215The third way is to specify an Internet subnetwork using a network and
216network mask that is defined as the set of all hosts with addresses within
217the subnetwork.
218This latter approach requires less overhead within the
219kernel and is recommended for cases where the export line refers to a
220large number of clients within an administrative subnet.
221.Pp
222The first two cases are specified by simply listing the name(s) separated
223by whitespace.
224All names are checked to see if they are ``netgroup'' names
225first and are assumed to be hostnames otherwise.
226Using the full domain specification for a hostname can normally
227circumvent the problem of a host that has the same name as a netgroup.
228The third case is specified by the flag
229.Sm off
230.Fl network No = Sy netname
231.Sm on
232and optionally
233.Sm off
234.Fl mask No = Sy netmask .
235.Sm on
236If the mask is not specified, it will default to the mask for that network
237class (A, B or C; see
238.Xr inet 4 ) .
239See the
240.Sx EXAMPLES
241section below.
242.Pp
243The
244.Xr mountd 8
245utility can be made to re-read the
246.Nm
247file by sending it a hangup signal as follows:
248.Bd -literal -offset indent
249kill -s HUP `cat /var/run/mountd.pid`
250.Ed
251.Pp
252After sending the
253.Dv SIGHUP ,
254check the
255.Xr syslogd 8
256output to see whether
257.Xr mountd 8
258logged any parsing errors in the
259.Nm
260file.
261.Sh FILES
262.Bl -tag -width /etc/exports -compact
263.It Pa /etc/exports
264the default remote mount-point file
265.El
266.Sh EXAMPLES
267.Bd -literal -offset indent
268/usr /usr/local -maproot=0:10 friends
269/usr -maproot=daemon grumpy.cis.uoguelph.ca 131.104.48.16
270/usr -ro -mapall=nobody
271/u -maproot=bin: -network 131.104.48 -mask 255.255.255.0
272/u2 -maproot=root friends
273/u2 -alldirs -network cis-net -mask cis-mask
274/cdrom -alldirs,quiet,ro -network 192.168.33.0 -mask 255.255.255.0
275.Ed
276.Pp
277Given that
278.Pa /usr ,
279.Pa /u
280and
281.Pa /u2
282are
283local file system mount points, the above example specifies the following:
284.Pp
285.Pa /usr
286is exported to hosts
287.Em friends
288where friends is specified in the netgroup file
289with users mapped to their remote credentials and
290root mapped to uid 0 and group 10.
291It is exported read-write and the hosts in ``friends'' can mount either /usr
292or /usr/local.
293It is exported to
294.Em 131.104.48.16
295and
296.Em grumpy.cis.uoguelph.ca
297with users mapped to their remote credentials and
298root mapped to the user and groups associated with ``daemon'';
299it is exported to the rest of the world as read-only with
300all users mapped to the user and groups associated with ``nobody''.
301.Pp
302.Pa /u
303is exported to all hosts on the subnetwork
304.Em 131.104.48
305with root mapped to the uid for ``bin'' and with no group access.
306.Pp
307.Pa /u2
308is exported to the hosts in ``friends'' with root mapped to uid and groups
309associated with ``root'';
310it is exported to all hosts on network ``cis-net'' allowing mounts at any
311directory within /u2.
312.Pp
313The file system rooted at
314.Pa /cdrom
315will exported read-only to the entire network 192.168.33.0/24, including
316all its subdirectories.
317Since
318.Pa /cdrom
319is the conventional mountpoint for a CD-ROM device, this export will
320fail if no CD-ROM medium is currently mounted there since that line
321would then attempt to export a subdirectory of the root file system
322with the
323.Fl alldirs
324option which is not allowed.
325The
326.Fl quiet
327option will then suppress the error message for this condition that
328would normally be syslogged.
329As soon as an actual CD-ROM is going to be mounted,
330.Xr mount 8
331will notify
332.Xr mountd 8
333about this situation, and the
334.Pa /cdrom
335file system will be exported as intended.
336Note that without using the
337.Fl alldirs
338option, the export would always succeed.
339While there is no CD-ROM medium mounted under
340.Pa /cdrom ,
341it would export the (normally empty) directory
342.Pa /cdrom
343of the root file system instead.
344.Sh SEE ALSO
345.Xr netgroup 5 ,
346.Xr mountd 8 ,
347.Xr nfsd 8 ,
348.Xr showmount 8
349.Sh BUGS
350The export options are tied to the local mount points in the kernel and
351must be non-contradictory for any exported subdirectory of the local
352server mount point.
353It is recommended that all exported directories within the same server
354file system be specified on adjacent lines going down the tree.
355You cannot specify a hostname that is also the name of a netgroup.
356Specifying the full domain specification for a hostname can normally
357circumvent the problem.
358