xref: /freebsd/usr.sbin/mountd/exports.5 (revision 2ef608de90629df37c29043afc638f8ff99ecfc4)
18fae3551SRodney W. Grimes.\" Copyright (c) 1989, 1991, 1993
28fae3551SRodney W. Grimes.\"	The Regents of the University of California.  All rights reserved.
38fae3551SRodney W. Grimes.\"
48fae3551SRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without
58fae3551SRodney W. Grimes.\" modification, are permitted provided that the following conditions
68fae3551SRodney W. Grimes.\" are met:
78fae3551SRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright
88fae3551SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer.
98fae3551SRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright
108fae3551SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer in the
118fae3551SRodney W. Grimes.\"    documentation and/or other materials provided with the distribution.
12fbbd9655SWarner Losh.\" 3. Neither the name of the University nor the names of its contributors
138fae3551SRodney W. Grimes.\"    may be used to endorse or promote products derived from this software
148fae3551SRodney W. Grimes.\"    without specific prior written permission.
158fae3551SRodney W. Grimes.\"
168fae3551SRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
178fae3551SRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
188fae3551SRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
198fae3551SRodney W. Grimes.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
208fae3551SRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
218fae3551SRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
228fae3551SRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
238fae3551SRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
248fae3551SRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
258fae3551SRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
268fae3551SRodney W. Grimes.\" SUCH DAMAGE.
278fae3551SRodney W. Grimes.\"
28*2ef608deSOlivier Certner.Dd October 08, 2024
298fae3551SRodney W. Grimes.Dt EXPORTS 5
308fae3551SRodney W. Grimes.Os
318fae3551SRodney W. Grimes.Sh NAME
328fae3551SRodney W. Grimes.Nm exports
338fae3551SRodney W. Grimes.Nd define remote mount points for
348fae3551SRodney W. Grimes.Tn NFS
358fae3551SRodney W. Grimesmount requests
368fae3551SRodney W. Grimes.Sh SYNOPSIS
377c7fb079SRuslan Ermilov.Nm
388fae3551SRodney W. Grimes.Sh DESCRIPTION
398fae3551SRodney W. GrimesThe
4074853402SPhilippe Charnier.Nm
418fae3551SRodney W. Grimesfile specifies remote mount points for the
428fae3551SRodney W. Grimes.Tn NFS
438fae3551SRodney W. Grimesmount protocol per the
448fae3551SRodney W. Grimes.Tn NFS
458fae3551SRodney W. Grimesserver specification; see
461252c1bbSRuslan Ermilov.%T "Network File System Protocol Specification" ,
471252c1bbSRuslan ErmilovRFC1094, Appendix A and
481252c1bbSRuslan Ermilov.%T "NFS: Network File System Version 3 Specification" ,
491252c1bbSRuslan ErmilovAppendix I.
508fae3551SRodney W. Grimes.Pp
518fae3551SRodney W. GrimesEach line in the file
528fae3551SRodney W. Grimes(other than comment lines that begin with a #)
538fae3551SRodney W. Grimesspecifies the mount point(s) and export flags within one local server
54bcc1d071SRick Macklemfile system or the NFSv4 tree root for one or more hosts.
556060f586SDima DorfmanA long line may be split over several lines by ending all but the
56a03e46ecSRuslan Ermilovlast line with a backslash
57a03e46ecSRuslan Ermilov.Pq Ql \e .
589d975e47SMark JohnstonA host may be specified only once for each local file system or the NFSv4 tree
599d975e47SMark Johnstonroot on the server and there may be only one default entry for each server
608fae3551SRodney W. Grimesfile system that applies to all other hosts.
6180d9aed4SDaniel GerzoThe latter exports the file system to the
6280d9aed4SDaniel Gerzo.Dq world
6380d9aed4SDaniel Gerzoand should
648fae3551SRodney W. Grimesbe used only when the file system contains public information.
658fae3551SRodney W. Grimes.Pp
668fae3551SRodney W. GrimesIn a mount entry,
678fae3551SRodney W. Grimesthe first field(s) specify the directory path(s) within a server file system
688fae3551SRodney W. Grimesthat can be mounted on by the corresponding client(s).
699d975e47SMark JohnstonNote well that exporting a directory on the server does not guarantee that only
709d975e47SMark Johnstonfiles below the exported directory will be accessible.
719d975e47SMark JohnstonThis is true even in the absence of the
729d975e47SMark Johnston.Fl alldirs
739d975e47SMark Johnstonflag.
749d975e47SMark JohnstonTo provide this guarantee, the exported directories must be local file system
759d975e47SMark Johnstonmount points on the server.
769d975e47SMark JohnstonFor example, if one exports
779d975e47SMark Johnston.Pa /home ,
789d975e47SMark Johnstonand
799d975e47SMark Johnston.Pa /home
809d975e47SMark Johnstonis not a file system mount point, then clients will be able to access arbitrary
819d975e47SMark Johnstonfiles on the root file system.
829d975e47SMark JohnstonAs such, to avoid confusion with respect to what is exported, it may be prudent
839d975e47SMark Johnstonto limit exported directories to server local file system mount points.
849d975e47SMark JohnstonWhen exporting ZFS datasets with the
859d975e47SMark Johnston.Sy sharenfs
869d975e47SMark Johnstonproperty, this is auomatically the case.
879d975e47SMark Johnston.Pp
889d975e47SMark JohnstonThere are three forms of the directory path specification.
898fae3551SRodney W. GrimesThe first is to list all mount points as absolute
908fae3551SRodney W. Grimesdirectory paths separated by whitespace.
91c95dfea9SRick MacklemThis list of directory paths should be considered an
92c95dfea9SRick Macklem.Dq administrative control ,
93c95dfea9SRick Macklemsince it is only enforced by the
94c95dfea9SRick Macklem.Xr mountd 8
95c95dfea9SRick Macklemdaemon and not the kernel.
96c95dfea9SRick MacklemAs such, it only applies to NFSv2 and NFSv3 mounts and only
97c95dfea9SRick Macklemwith respect to the client's use of the mount protocol.
988fae3551SRodney W. GrimesThe second is to specify the pathname of the root of the file system
998fae3551SRodney W. Grimesfollowed by the
1008fae3551SRodney W. Grimes.Fl alldirs
1018fae3551SRodney W. Grimesflag;
102a62dc406SDoug Rabsonthis form allows the host(s) to mount at any point within the file system,
10387564113SPeter Wemmincluding regular files if the
10487564113SPeter Wemm.Fl r
10591d299f5SKris Kennawayoption is used on
10691d299f5SKris Kennaway.Xr mountd 8 .
107c95dfea9SRick MacklemBecause NFSv4 does not use the mount protocol,
108c95dfea9SRick Macklemthe
109c95dfea9SRick Macklem.Dq administrative controls
11091095367SRick Macklemare not applied and all directories within this server
11191095367SRick Macklemfile system are mountable via NFSv4 even if the
112c95dfea9SRick Macklem.Fl alldirs
11391095367SRick Macklemflag has not been specified.
114bcc1d071SRick MacklemThe third form has the string ``V4:'' followed by a single absolute path
115580a9482SMaxim Konovalovname, to specify the NFSv4 tree root.
116c95dfea9SRick MacklemThis line does not export any file system, but simply marks where the root
117c95dfea9SRick Macklemof the server's directory tree is for NFSv4 clients.
118c95dfea9SRick MacklemThe exported file systems for NFSv4 are specified via the other lines
119c95dfea9SRick Macklemin the
1204d36343eSJoel Dahl.Nm
121c95dfea9SRick Macklemfile in the same way as for NFSv2 and NFSv3.
1228fae3551SRodney W. GrimesThe pathnames must not have any symbolic links in them and should not have
12380d9aed4SDaniel Gerzoany
12440873064SDaniel Gerzo.Dq Pa \&.
12580d9aed4SDaniel Gerzoor
12640873064SDaniel Gerzo.Dq Pa ..
12780d9aed4SDaniel Gerzocomponents.
128922e78f6SRick MacklemPathnames are decoded by
129922e78f6SRick Macklem.Xr strunvis 3
130922e78f6SRick Macklemallowing special characters to be included in the directory name(s).
131922e78f6SRick MacklemIn particular, whitespace, such as embedded blanks in directory names
132922e78f6SRick Macklemcan be handled.
133922e78f6SRick MacklemFor example, a blank can be encoded as \(rs040.
134922e78f6SRick Macklem.Xr vis 1
135922e78f6SRick Macklemwith the
136922e78f6SRick Macklem.Fl M
137922e78f6SRick Macklemoption may be used to encode directory name(s) with embedded special
138922e78f6SRick Macklemcharacters.
1398fae3551SRodney W. GrimesMount points for a file system may appear on multiple lines each with
1408fae3551SRodney W. Grimesdifferent sets of hosts and export options.
1418fae3551SRodney W. Grimes.Pp
1428fae3551SRodney W. GrimesThe second component of a line specifies how the file system is to be
1438fae3551SRodney W. Grimesexported to the host set.
1448fae3551SRodney W. GrimesThe option flags specify whether the file system
14540873064SDaniel Gerzois exported read-only or read-write and how the client UID is mapped to
1468fae3551SRodney W. Grimesuser credentials on the server.
1479acc400bSRick MacklemFor the NFSv4 tree root, the only options that can be specified in this
1489acc400bSRick Macklemsection are ones related to security:
1499acc400bSRick Macklem.Fl sec ,
1509acc400bSRick Macklem.Fl tls ,
1519acc400bSRick Macklem.Fl tlscert
1529acc400bSRick Macklemand
1539acc400bSRick Macklem.Fl tlscertuser .
1548fae3551SRodney W. Grimes.Pp
1558fae3551SRodney W. GrimesExport options are specified as follows:
1568fae3551SRodney W. Grimes.Pp
1578fae3551SRodney W. Grimes.Sm off
1586f8f0226SDaniel Gerzo.Fl maproot Li = Sy user
1598fae3551SRodney W. Grimes.Sm on
1608fae3551SRodney W. GrimesThe credential of the specified user is used for remote access by root.
1618fae3551SRodney W. GrimesThe credential includes all the groups to which the user is a member
1628fae3551SRodney W. Grimeson the local machine (see
1638fae3551SRodney W. Grimes.Xr id 1 ) .
1648fae3551SRodney W. GrimesThe user may be specified by name or number.
165b875c2e9SJosh PaetzelThe user string may be quoted, or use backslash escaping.
1668fae3551SRodney W. Grimes.Pp
1678fae3551SRodney W. Grimes.Sm off
1686f8f0226SDaniel Gerzo.Fl maproot Li = Sy user:group1:group2:...
1698fae3551SRodney W. Grimes.Sm on
1708fae3551SRodney W. GrimesThe colon separated list is used to specify the precise credential
1718fae3551SRodney W. Grimesto be used for remote access by root.
1728fae3551SRodney W. GrimesThe elements of the list may be either names or numbers.
173*2ef608deSOlivier CertnerNote that
174*2ef608deSOlivier Certner.Cm user:
175*2ef608deSOlivier Certnershould be used to specify a credential containing no groups, in which case the
176*2ef608deSOlivier Certnerestablished credential will use
177*2ef608deSOlivier Certner.Ql nogroup ,
178*2ef608deSOlivier Certnerelse 65533
179*2ef608deSOlivier Certner.Pq Dv GID_NOGROUP ,
180*2ef608deSOlivier Certneras the fallback group
181*2ef608deSOlivier Certner.Pq a credential object must have at least one group internally .
182*2ef608deSOlivier CertnerUsing just
183*2ef608deSOlivier Certner.Cm user
184*2ef608deSOlivier Certner.Pq without colon at end
185*2ef608deSOlivier Certnerfalls into the
186*2ef608deSOlivier Certner.Sm off
187*2ef608deSOlivier Certner.Fl maproot Li = Sy user
188*2ef608deSOlivier Certner.Sm on
189*2ef608deSOlivier Certnercase described above.
190b875c2e9SJosh PaetzelThe group names may be quoted, or use backslash escaping.
1918fae3551SRodney W. Grimes.Pp
1928fae3551SRodney W. Grimes.Sm off
1936f8f0226SDaniel Gerzo.Fl mapall Li = Sy user
1948fae3551SRodney W. Grimes.Sm on
1958fae3551SRodney W. Grimesor
1968fae3551SRodney W. Grimes.Sm off
1976f8f0226SDaniel Gerzo.Fl mapall Li = Sy user:group1:group2:...
1988fae3551SRodney W. Grimes.Sm on
19940873064SDaniel Gerzospecifies a mapping for all client UIDs (including root)
2008fae3551SRodney W. Grimesusing the same semantics as
2018fae3551SRodney W. Grimes.Fl maproot .
2028fae3551SRodney W. Grimes.Pp
2038fae3551SRodney W. GrimesThe option
2048fae3551SRodney W. Grimes.Fl r
2058fae3551SRodney W. Grimesis a synonym for
2068fae3551SRodney W. Grimes.Fl maproot
2078fae3551SRodney W. Grimesin an effort to be backward compatible with older export file formats.
2088fae3551SRodney W. Grimes.Pp
2098fae3551SRodney W. GrimesIn the absence of
2108fae3551SRodney W. Grimes.Fl maproot
2118fae3551SRodney W. Grimesand
2128fae3551SRodney W. Grimes.Fl mapall
2136ab9e0dfSRick Macklemoptions, remote accesses by root will result in using a credential of 65534:65533.
2148fae3551SRodney W. GrimesAll other users will be mapped to their remote credential.
2158fae3551SRodney W. GrimesIf a
2168fae3551SRodney W. Grimes.Fl maproot
2178fae3551SRodney W. Grimesoption is given,
2186ab9e0dfSRick Macklemremote access by root will be mapped to that credential instead of 65534:65533.
2198fae3551SRodney W. GrimesIf a
2208fae3551SRodney W. Grimes.Fl mapall
2218fae3551SRodney W. Grimesoption is given,
2228fae3551SRodney W. Grimesall users (including root) will be mapped to that credential in
2238fae3551SRodney W. Grimesplace of their own.
2248fae3551SRodney W. Grimes.Pp
225a9148abdSDoug Rabson.Sm off
226a9148abdSDoug Rabson.Fl sec Li = Sy flavor1:flavor2...
227a9148abdSDoug Rabson.Sm on
228a9148abdSDoug Rabsonspecifies a colon separated list of acceptable security flavors to be
229a9148abdSDoug Rabsonused for remote access.
230a9148abdSDoug RabsonSupported security flavors are sys, krb5, krb5i and krb5p.
231a9148abdSDoug RabsonIf multiple flavors are listed, they should be ordered with the most
232a9148abdSDoug Rabsonpreferred flavor first.
233a9148abdSDoug RabsonIf this option is not present,
234a9148abdSDoug Rabsonthe default security flavor list of just sys is used.
235a9148abdSDoug Rabson.Pp
2368fae3551SRodney W. GrimesThe
2378fae3551SRodney W. Grimes.Fl ro
2388fae3551SRodney W. Grimesoption specifies that the file system should be exported read-only
2398fae3551SRodney W. Grimes(default read/write).
2408fae3551SRodney W. GrimesThe option
2418fae3551SRodney W. Grimes.Fl o
2428fae3551SRodney W. Grimesis a synonym for
2438fae3551SRodney W. Grimes.Fl ro
2448fae3551SRodney W. Grimesin an effort to be backward compatible with older export file formats.
2458fae3551SRodney W. Grimes.Pp
24674853402SPhilippe Charnier.Tn WebNFS
24774853402SPhilippe Charnierexports strictly according to the spec (RFC 2054 and RFC 2055) can
248cb3923e0SDoug Rabsonbe done with the
249cb3923e0SDoug Rabson.Fl public
250f63f700eSSheldon Hearnflag.
251f63f700eSSheldon HearnHowever, this flag in itself allows r/w access to all files in
25240873064SDaniel Gerzothe file system, not requiring reserved ports and not remapping UIDs.
253f63f700eSSheldon HearnIt
254cb3923e0SDoug Rabsonis only provided to conform to the spec, and should normally not be used.
25574853402SPhilippe CharnierFor a
25674853402SPhilippe Charnier.Tn WebNFS
25774853402SPhilippe Charnierexport,
258cb3923e0SDoug Rabsonuse the
259cb3923e0SDoug Rabson.Fl webnfs
260cb3923e0SDoug Rabsonflag, which implies
261cb3923e0SDoug Rabson.Fl public ,
262cb3923e0SDoug Rabson.Sm off
263cb3923e0SDoug Rabson.Fl mapall No = Sy nobody
264cb3923e0SDoug Rabson.Sm on
265cb3923e0SDoug Rabsonand
266cb3923e0SDoug Rabson.Fl ro .
267687c7280SCeri DaviesNote that only one file system can be
268687c7280SCeri Davies.Tn WebNFS
269687c7280SCeri Daviesexported on a server.
270cb3923e0SDoug Rabson.Pp
271cb3923e0SDoug RabsonA
272cb3923e0SDoug Rabson.Sm off
27310affec4SJoseph Koshy.Fl index No = Pa file
27474853402SPhilippe Charnier.Sm on
275cb3923e0SDoug Rabsonoption can be used to specify a file whose handle will be returned if
27694ba280cSRuslan Ermilova directory is looked up using the public filehandle
27794ba280cSRuslan Ermilov.Pq Tn WebNFS .
278f63f700eSSheldon HearnThis is to mimic the behavior of URLs.
279f63f700eSSheldon HearnIf no
280cb3923e0SDoug Rabson.Fl index
281cb3923e0SDoug Rabsonoption is specified, a directory filehandle will be returned as usual.
282cb3923e0SDoug RabsonThe
283cb3923e0SDoug Rabson.Fl index
284cb3923e0SDoug Rabsonoption only makes sense in combination with the
285cb3923e0SDoug Rabson.Fl public
286cb3923e0SDoug Rabsonor
287cb3923e0SDoug Rabson.Fl webnfs
288cb3923e0SDoug Rabsonflags.
289cb3923e0SDoug Rabson.Pp
2909acc400bSRick MacklemThe
2919acc400bSRick Macklem.Fl tls ,
2929acc400bSRick Macklem.Fl tlscert
2939acc400bSRick Macklemand
2949acc400bSRick Macklem.Fl tlscertuser
2959acc400bSRick Macklemexport options are used to require the client to use TLS for the mount(s)
296401c0f8aSRick Macklemper RFC 9289.
2979acc400bSRick MacklemFor NFS mounts using TLS to work,
2989acc400bSRick Macklem.Xr rpc.tlsservd 8
2999acc400bSRick Macklemmust be running on the server.
3009acc400bSRick Macklem.Bd -filled -offset indent
3019acc400bSRick Macklem.Fl tls
3029acc400bSRick Macklemrequires that the client use TLS.
3039acc400bSRick Macklem.br
3049acc400bSRick Macklem.Fl tlscert
3059acc400bSRick Macklemrequires that the client use TLS and provide a verifiable X.509 certificate
3069acc400bSRick Macklemduring TLS handshake.
3079acc400bSRick Macklem.br
3089acc400bSRick Macklem.Fl tlscertuser
3099acc400bSRick Macklemrequires that the client use TLS and provide a verifiable X.509 certificate.
3109acc400bSRick MacklemThe otherName component of the certificate's subjAltName must have a
3119acc400bSRick Mackleman OID of 1.3.6.1.4.1.2238.1.1.1 and a UTF8 string of the form
3129acc400bSRick Macklem.Dq user@domain .
3139acc400bSRick Macklem.Dq user@domain
3149acc400bSRick Macklemwill be translated to the credentials of the specified user in the same
3159acc400bSRick Macklemmanner as
3169acc400bSRick Macklem.Xr nfsuserd 8 ,
3179acc400bSRick Macklemwhere
3189acc400bSRick Macklem.Dq user
3199acc400bSRick Macklemis normally a username is the server's password database and
3209acc400bSRick Macklem.Dq domain
3219acc400bSRick Macklemis the DNS domain name for the server.
3229acc400bSRick MacklemAll RPCs will be performed using these credentials instead of the
3239acc400bSRick Macklemones in the RPC header in a manner similar to
3249acc400bSRick Macklem.Sm off
3259acc400bSRick Macklem.Fl mapall Li = Sy user .
3269acc400bSRick Macklem.Sm on
3279acc400bSRick Macklem.Ed
3289acc400bSRick Macklem.Pp
3299acc400bSRick MacklemIf none of these three flags are specified, TLS mounts are permitted but
3309acc400bSRick Macklemnot required.
3319acc400bSRick Macklem.Pp
332288fa14aSJoerg WunschSpecifying the
333288fa14aSJoerg Wunsch.Fl quiet
334288fa14aSJoerg Wunschoption will inhibit some of the syslog diagnostics for bad lines in
335288fa14aSJoerg Wunsch.Pa /etc/exports .
336288fa14aSJoerg WunschThis can be useful to avoid annoying error messages for known possible
337288fa14aSJoerg Wunschproblems (see
338288fa14aSJoerg Wunsch.Sx EXAMPLES
339288fa14aSJoerg Wunschbelow).
340288fa14aSJoerg Wunsch.Pp
3418fae3551SRodney W. GrimesThe third component of a line specifies the host set to which the line applies.
3428fae3551SRodney W. GrimesThe set may be specified in three ways.
3438fae3551SRodney W. GrimesThe first way is to list the host name(s) separated by white space.
34480d9aed4SDaniel Gerzo(Standard Internet
34580d9aed4SDaniel Gerzo.Dq dot
34680d9aed4SDaniel Gerzoaddresses may be used in place of names.)
34780d9aed4SDaniel GerzoThe second way is to specify a
34880d9aed4SDaniel Gerzo.Dq netgroup
34940873064SDaniel Gerzoas defined in the
35040873064SDaniel Gerzo.Pa netgroup
35140873064SDaniel Gerzofile (see
3528fae3551SRodney W. Grimes.Xr netgroup 5 ) .
35374853402SPhilippe CharnierThe third way is to specify an Internet subnetwork using a network and
3548fae3551SRodney W. Grimesnetwork mask that is defined as the set of all hosts with addresses within
3558fae3551SRodney W. Grimesthe subnetwork.
3568fae3551SRodney W. GrimesThis latter approach requires less overhead within the
3578fae3551SRodney W. Grimeskernel and is recommended for cases where the export line refers to a
3588fae3551SRodney W. Grimeslarge number of clients within an administrative subnet.
3598fae3551SRodney W. Grimes.Pp
3608fae3551SRodney W. GrimesThe first two cases are specified by simply listing the name(s) separated
3618fae3551SRodney W. Grimesby whitespace.
36280d9aed4SDaniel GerzoAll names are checked to see if they are
36380d9aed4SDaniel Gerzo.Dq netgroup
36480d9aed4SDaniel Gerzonames
3658fae3551SRodney W. Grimesfirst and are assumed to be hostnames otherwise.
3668fae3551SRodney W. GrimesUsing the full domain specification for a hostname can normally
3678fae3551SRodney W. Grimescircumvent the problem of a host that has the same name as a netgroup.
3688fae3551SRodney W. GrimesThe third case is specified by the flag
3698fae3551SRodney W. Grimes.Sm off
3706f8f0226SDaniel Gerzo.Fl network Li = Sy netname Op Li / Ar prefixlength
3718fae3551SRodney W. Grimes.Sm on
3728fae3551SRodney W. Grimesand optionally
3738fae3551SRodney W. Grimes.Sm off
3748fae3551SRodney W. Grimes.Fl mask No = Sy netmask .
3758fae3551SRodney W. Grimes.Sm on
37680d9aed4SDaniel GerzoThe netmask may be specified either by attaching a
37780d9aed4SDaniel Gerzo.Ar prefixlength
37880d9aed4SDaniel Gerzoto the
37980d9aed4SDaniel Gerzo.Fl network
38080d9aed4SDaniel Gerzooption, or by using a separate
38180d9aed4SDaniel Gerzo.Fl mask
38280d9aed4SDaniel Gerzooption.
38392aebdeaSMike KarelsIf the mask is not specified, it will default to the historical mask
38492aebdeaSMike Karelsfor that network class (A, B, or C; see
385906c1e27SMike Pritchard.Xr inet 4 ) .
38692aebdeaSMike KarelsThis usage is deprecated, and will elicit a warning log message.
387288fa14aSJoerg WunschSee the
388288fa14aSJoerg Wunsch.Sx EXAMPLES
389288fa14aSJoerg Wunschsection below.
3908fae3551SRodney W. Grimes.Pp
39180d9aed4SDaniel GerzoScoped IPv6 address must carry scope identifier as documented in
39280d9aed4SDaniel Gerzo.Xr inet6 4 .
39380d9aed4SDaniel GerzoFor example,
39440873064SDaniel Gerzo.Dq Li fe80::%re2/10
39540873064SDaniel Gerzois used to specify
39640873064SDaniel Gerzo.Li fe80::/10
39740873064SDaniel Gerzoon
39840873064SDaniel Gerzo.Li re2
39940873064SDaniel Gerzointerface.
40080d9aed4SDaniel Gerzo.Pp
401bcc1d071SRick MacklemFor the third form which specifies the NFSv4 tree root, the directory path
402bcc1d071SRick Macklemspecifies the location within the server's file system tree which is the
403bcc1d071SRick Macklemroot of the NFSv4 tree.
40491095367SRick MacklemThere can only be one NFSv4 root directory per server.
40591095367SRick MacklemAs such, all entries of this form must specify the same directory path.
406211024e9SRick MacklemFor file systems other than ZFS,
407211024e9SRick Macklemthis location can be any directory and does not
4086d6d6c36SGordon Berglingneed to be within an exported file system.
4096d6d6c36SGordon BerglingIf it is not in an exported file system, a very limited set of operations
4106d6d6c36SGordon Berglingare permitted, so that an NFSv4 client can traverse the tree to an
4116d6d6c36SGordon Berglingexported file system.
412bcc1d071SRick MacklemAlthough parts of the NFSv4 tree can be non-exported, the entire NFSv4 tree
413bcc1d071SRick Macklemmust consist of local file systems capable of being exported via NFS.
414211024e9SRick MacklemAll ZFS file systems in the subtree below the NFSv4 tree root must be
415211024e9SRick Macklemexported.
416bcc1d071SRick MacklemNFSv4 does not use the mount protocol and does permit clients to cross server
417bcc1d071SRick Macklemmount point boundaries, although not all clients are capable of crossing the
418bcc1d071SRick Macklemmount points.
419bcc1d071SRick Macklem.Pp
420bcc1d071SRick MacklemThe
421bcc1d071SRick Macklem.Fl sec
422bcc1d071SRick Macklemoption on these line(s) specifies what security flavors may be used for
4236d6d6c36SGordon BerglingNFSv4 operations that do not use file handles.
4246d6d6c36SGordon BerglingSince these operations (SetClientID, SetClientIDConfirm, Renew, DelegPurge
4256d6d6c36SGordon Berglingand ReleaseLockOnwer) allocate/modify state in the server, it is possible
4266d6d6c36SGordon Berglingto restrict some clients to the use of the krb5[ip] security flavors,
4276d6d6c36SGordon Berglingvia this option.
428bcc1d071SRick MacklemSee the
429bcc1d071SRick Macklem.Sx EXAMPLES
430bcc1d071SRick Macklemsection below.
431bcc1d071SRick MacklemThis third form is meaningless for NFSv2 and NFSv3 and is ignored for them.
432bcc1d071SRick Macklem.Pp
433288fa14aSJoerg WunschThe
434288fa14aSJoerg Wunsch.Xr mountd 8
435288fa14aSJoerg Wunschutility can be made to re-read the
436288fa14aSJoerg Wunsch.Nm
437288fa14aSJoerg Wunschfile by sending it a hangup signal as follows:
438288fa14aSJoerg Wunsch.Bd -literal -offset indent
43988d09ddeSMark Johnstonservice mountd reload
440288fa14aSJoerg Wunsch.Ed
441288fa14aSJoerg Wunsch.Pp
442288fa14aSJoerg WunschAfter sending the
443288fa14aSJoerg Wunsch.Dv SIGHUP ,
444288fa14aSJoerg Wunschcheck the
445288fa14aSJoerg Wunsch.Xr syslogd 8
446288fa14aSJoerg Wunschoutput to see whether
447288fa14aSJoerg Wunsch.Xr mountd 8
448288fa14aSJoerg Wunschlogged any parsing errors in the
449288fa14aSJoerg Wunsch.Nm
450288fa14aSJoerg Wunschfile.
451288fa14aSJoerg Wunsch.Sh FILES
452288fa14aSJoerg Wunsch.Bl -tag -width /etc/exports -compact
453288fa14aSJoerg Wunsch.It Pa /etc/exports
454288fa14aSJoerg Wunschthe default remote mount-point file
455288fa14aSJoerg Wunsch.El
456288fa14aSJoerg Wunsch.Sh EXAMPLES
457f9572577SMateusz PiotrowskiGiven that
458f9572577SMateusz Piotrowski.Pa /usr , /u , /a
459f9572577SMateusz Piotrowskiand
460f9572577SMateusz Piotrowski.Pa /u2
461f9572577SMateusz Piotrowskiare
462f9572577SMateusz Piotrowskilocal file system mount points, let's consider the following example:
463f9572577SMateusz Piotrowski.Pp
4648fae3551SRodney W. Grimes.Bd -literal -offset indent
4658fae3551SRodney W. Grimes/usr /usr/local -maproot=0:10 friends
4668fae3551SRodney W. Grimes/usr -maproot=daemon grumpy.cis.uoguelph.ca 131.104.48.16
4678fae3551SRodney W. Grimes/usr -ro -mapall=nobody
4688fae3551SRodney W. Grimes/u -maproot=bin: -network 131.104.48 -mask 255.255.255.0
46980d9aed4SDaniel Gerzo/a -network 192.168.0/24
47080d9aed4SDaniel Gerzo/a -network 3ffe:1ce1:1:fe80::/64
4718fae3551SRodney W. Grimes/u2 -maproot=root friends
472492d981bSMark Murray/u2 -alldirs -network cis-net -mask cis-mask
473288fa14aSJoerg Wunsch/cdrom -alldirs,quiet,ro -network 192.168.33.0 -mask 255.255.255.0
474a9148abdSDoug Rabson/private -sec=krb5i
475a9148abdSDoug Rabson/secret -sec=krb5p
476bcc1d071SRick MacklemV4: /	-sec=krb5:krb5i:krb5p -network 131.104.48 -mask 255.255.255.0
477bcc1d071SRick MacklemV4: /	-sec=sys:krb5:krb5i:krb5p grumpy.cis.uoguelph.ca
4788fae3551SRodney W. Grimes.Ed
4798fae3551SRodney W. Grimes.Pp
480f9572577SMateusz PiotrowskiThe file systems rooted at
481f9572577SMateusz Piotrowski.Pa /usr
4828fae3551SRodney W. Grimesand
483f9572577SMateusz Piotrowski.Pa /usr/local
484f9572577SMateusz Piotrowskiare exported to hosts within the
485f9572577SMateusz Piotrowski.Dq friends
486f9572577SMateusz Piotrowskinetwork group
487f9572577SMateusz Piotrowskiwith users mapped to their remote credentials and
488f9572577SMateusz Piotrowskiroot mapped to UID 0 and group 10.
489f9572577SMateusz PiotrowskiThey are exported read-write and the hosts in
490f9572577SMateusz Piotrowski.Dq friends .
49188b3d518SDavid E. O'Brien.Pp
49240873064SDaniel GerzoThe file system rooted at
49310affec4SJoseph Koshy.Pa /usr
494f9572577SMateusz Piotrowskiis exported to
4958fae3551SRodney W. Grimes.Em 131.104.48.16
4968fae3551SRodney W. Grimesand
4978fae3551SRodney W. Grimes.Em grumpy.cis.uoguelph.ca
4988fae3551SRodney W. Grimeswith users mapped to their remote credentials and
49980d9aed4SDaniel Gerzoroot mapped to the user and groups associated with
50080d9aed4SDaniel Gerzo.Dq daemon ;
5018fae3551SRodney W. Grimesit is exported to the rest of the world as read-only with
50280d9aed4SDaniel Gerzoall users mapped to the user and groups associated with
50380d9aed4SDaniel Gerzo.Dq nobody .
5048fae3551SRodney W. Grimes.Pp
50540873064SDaniel GerzoThe file system rooted at
50610affec4SJoseph Koshy.Pa /u
5078fae3551SRodney W. Grimesis exported to all hosts on the subnetwork
5088fae3551SRodney W. Grimes.Em 131.104.48
50940873064SDaniel Gerzowith root mapped to the UID for
51080d9aed4SDaniel Gerzo.Dq bin
51180d9aed4SDaniel Gerzoand with no group access.
5128fae3551SRodney W. Grimes.Pp
51340873064SDaniel GerzoThe file system rooted at
51410affec4SJoseph Koshy.Pa /u2
51580d9aed4SDaniel Gerzois exported to the hosts in
51680d9aed4SDaniel Gerzo.Dq friends
51740873064SDaniel Gerzowith root mapped to UID and groups
51880d9aed4SDaniel Gerzoassociated with
51980d9aed4SDaniel Gerzo.Dq root ;
52080d9aed4SDaniel Gerzoit is exported to all hosts on network
52180d9aed4SDaniel Gerzo.Dq cis-net
52280d9aed4SDaniel Gerzoallowing mounts at any
523492d981bSMark Murraydirectory within /u2.
5242f47c461SSheldon Hearn.Pp
52540873064SDaniel GerzoThe file system rooted at
52680d9aed4SDaniel Gerzo.Pa /a
52780d9aed4SDaniel Gerzois exported to the network 192.168.0.0, with a netmask of 255.255.255.0.
52840873064SDaniel GerzoHowever, the netmask length in the entry for
52980d9aed4SDaniel Gerzo.Pa /a
53040873064SDaniel Gerzois not specified through a
53140873064SDaniel Gerzo.Fl mask
53240873064SDaniel Gerzooption, but through the
53340873064SDaniel Gerzo.Li / Ns Ar prefix
53440873064SDaniel Gerzonotation.
53540873064SDaniel Gerzo.Pp
53640873064SDaniel GerzoThe file system rooted at
53740873064SDaniel Gerzo.Pa /a
53840873064SDaniel Gerzois also exported to the IPv6 network
53940873064SDaniel Gerzo.Li 3ffe:1ce1:1:fe80::
54040873064SDaniel Gerzoaddress, using the upper 64 bits as the prefix.
54180d9aed4SDaniel GerzoNote that, unlike with IPv4 network addresses, the specified network
54280d9aed4SDaniel Gerzoaddress must be complete, and not just contain the upper bits.
54340873064SDaniel GerzoWith IPv6 addresses, the
54440873064SDaniel Gerzo.Fl mask
54540873064SDaniel Gerzooption must not be used.
54680d9aed4SDaniel Gerzo.Pp
547288fa14aSJoerg WunschThe file system rooted at
54810affec4SJoseph Koshy.Pa /cdrom
54940873064SDaniel Gerzowill be exported read-only to the entire network 192.168.33.0/24, including
550288fa14aSJoerg Wunschall its subdirectories.
551288fa14aSJoerg WunschSince
55210affec4SJoseph Koshy.Pa /cdrom
553288fa14aSJoerg Wunschis the conventional mountpoint for a CD-ROM device, this export will
554288fa14aSJoerg Wunschfail if no CD-ROM medium is currently mounted there since that line
555288fa14aSJoerg Wunschwould then attempt to export a subdirectory of the root file system
556288fa14aSJoerg Wunschwith the
557288fa14aSJoerg Wunsch.Fl alldirs
558288fa14aSJoerg Wunschoption which is not allowed.
5592f47c461SSheldon HearnThe
560288fa14aSJoerg Wunsch.Fl quiet
561288fa14aSJoerg Wunschoption will then suppress the error message for this condition that
562288fa14aSJoerg Wunschwould normally be syslogged.
563288fa14aSJoerg WunschAs soon as an actual CD-ROM is going to be mounted,
564288fa14aSJoerg Wunsch.Xr mount 8
565288fa14aSJoerg Wunschwill notify
5662f47c461SSheldon Hearn.Xr mountd 8
567288fa14aSJoerg Wunschabout this situation, and the
56810affec4SJoseph Koshy.Pa /cdrom
56957bd0fc6SJens Schweikhardtfile system will be exported as intended.
570288fa14aSJoerg WunschNote that without using the
571288fa14aSJoerg Wunsch.Fl alldirs
572288fa14aSJoerg Wunschoption, the export would always succeed.
573288fa14aSJoerg WunschWhile there is no CD-ROM medium mounted under
57410affec4SJoseph Koshy.Pa /cdrom ,
575288fa14aSJoerg Wunschit would export the (normally empty) directory
57610affec4SJoseph Koshy.Pa /cdrom
577288fa14aSJoerg Wunschof the root file system instead.
578a9148abdSDoug Rabson.Pp
579a9148abdSDoug RabsonThe file system rooted at
580a9148abdSDoug Rabson.Pa /private
581a9148abdSDoug Rabsonwill be exported using Kerberos 5 authentication and will require
582a9148abdSDoug Rabsonintegrity protected messages for all accesses.
583a9148abdSDoug RabsonThe file system rooted at
584a9148abdSDoug Rabson.Pa /secret
585a9148abdSDoug Rabsonwill also be exported using Kerberos 5 authentication and all messages
586a9148abdSDoug Rabsonused to access it will be encrypted.
587bcc1d071SRick Macklem.Pp
588bcc1d071SRick MacklemFor the experimental server, the NFSv4 tree is rooted at ``/'',
589bcc1d071SRick Macklemand any client within the 131.104.48 subnet is permitted to perform NFSv4 state
590bcc1d071SRick Macklemoperations on the server, so long as valid Kerberos credentials are provided.
591bcc1d071SRick MacklemThe machine grumpy.cis.uoguelph.ca is permitted to perform NFSv4 state
592bcc1d071SRick Macklemoperations on the server using AUTH_SYS credentials, as well as Kerberos ones.
593aa255a10SMartin Cracauer.Pp
594aa255a10SMartin CracauerIn the following example some directories are exported as NFSv3 and NFSv4:
595aa255a10SMartin Cracauer.Bd -literal -offset indent
596aa255a10SMartin CracauerV4: /wingsdl/nfsv4
597aa255a10SMartin Cracauer/wingsdl/nfsv4/usr-ports -maproot=root -network 172.16.0.0 -mask 255.255.0.0
598aa255a10SMartin Cracauer/wingsdl/nfsv4/clasper   -maproot=root clasper
599aa255a10SMartin Cracauer.Ed
600aa255a10SMartin Cracauer.Pp
601aa255a10SMartin CracauerOnly one V4: line is needed or allowed to declare where NFSv4 is
6026d6d6c36SGordon Berglingrooted.
6036d6d6c36SGordon BerglingThe other lines declare specific exported directories with
604aa255a10SMartin Cracauertheir absolute paths given in /etc/exports.
605aa255a10SMartin Cracauer.Pp
606aa255a10SMartin CracauerThe exported directories' paths are used for both v3 and v4.
6076d6d6c36SGordon BerglingHowever, they are interpreted differently for v3 and v4.
6086d6d6c36SGordon BerglingA client mount command for usr-ports would use the server-absolute name when
609aa255a10SMartin Cracauerusing nfsv3:
610aa255a10SMartin Cracauer.Bd -literal -offset indent
611aa255a10SMartin Cracauermount server:/wingsdl/nfsv4/usr-ports /mnt/tmp
612aa255a10SMartin Cracauer.Ed
613aa255a10SMartin Cracauer.Pp
614aa255a10SMartin CracauerA mount command using NFSv4 would use the path relative to the NFSv4
615aa255a10SMartin Cracauerroot:
616aa255a10SMartin Cracauer.Bd -literal -offset indent
617aa255a10SMartin Cracauermount server:/usr-ports /mnt/tmp
618aa255a10SMartin Cracauer.Ed
619aa255a10SMartin Cracauer.Pp
620aa255a10SMartin CracauerThis also differentiates which version you want if the client can do
6216d6d6c36SGordon Berglingboth v3 and v4.
6226d6d6c36SGordon BerglingThe former will only ever do a v3 mount and the latter will only ever
6236d6d6c36SGordon Berglingdo a v4 mount.
624aa255a10SMartin Cracauer.Pp
625aa255a10SMartin CracauerNote that due to different mount behavior between NFSv3 and NFSv4 a
626aa255a10SMartin CracauerNFSv4 mount request for a directory that the client does not have
627aa255a10SMartin Cracauerpermission for will succeed and read/write access will fail
628aa255a10SMartin Cracauerafterwards, whereas NFSv3 rejects the mount request.
6298fae3551SRodney W. Grimes.Sh SEE ALSO
630922e78f6SRick Macklem.Xr vis 1 ,
631922e78f6SRick Macklem.Xr strunvis 3 ,
632639e19ecSEdward Tomasz Napierala.Xr nfsv4 4 ,
6338fae3551SRodney W. Grimes.Xr netgroup 5 ,
6349d975e47SMark Johnston.Xr zfsprops 7 ,
6358fae3551SRodney W. Grimes.Xr mountd 8 ,
6368fae3551SRodney W. Grimes.Xr nfsd 8 ,
6379acc400bSRick Macklem.Xr rpc.tlsservd 8 ,
63888d09ddeSMark Johnston.Xr service 8 ,
6398fae3551SRodney W. Grimes.Xr showmount 8
6409acc400bSRick Macklem.Sh STANDARDS
641f9572577SMateusz PiotrowskiThe implementation is based on the following documents:
642f9572577SMateusz Piotrowski.Bl -dash
643f9572577SMateusz Piotrowski.It
6449acc400bSRick Macklem.Rs
6459acc400bSRick Macklem.%T "Network File System Protocol Specification, Appendix A, RFC 1094"
646f9572577SMateusz Piotrowski.Re
647f9572577SMateusz Piotrowski.It
648f9572577SMateusz Piotrowski.Rs
6499acc400bSRick Macklem.%T "NFS: Network File System Version 3, Appendix I, RFC 1813"
650f9572577SMateusz Piotrowski.Re
651f9572577SMateusz Piotrowski.It
652f9572577SMateusz Piotrowski.Rs
653401c0f8aSRick Macklem.%T "Towards Remote Procedure Call Encryption by Default, RFC 9289"
6549acc400bSRick Macklem.Re
655f9572577SMateusz Piotrowski.El
6568fae3551SRodney W. Grimes.Sh BUGS
6578fae3551SRodney W. GrimesThe export options are tied to the local mount points in the kernel and
6588fae3551SRodney W. Grimesmust be non-contradictory for any exported subdirectory of the local
6598fae3551SRodney W. Grimesserver mount point.
6608fae3551SRodney W. GrimesIt is recommended that all exported directories within the same server
6618fae3551SRodney W. Grimesfile system be specified on adjacent lines going down the tree.
6628fae3551SRodney W. GrimesYou cannot specify a hostname that is also the name of a netgroup.
6638fae3551SRodney W. GrimesSpecifying the full domain specification for a hostname can normally
6648fae3551SRodney W. Grimescircumvent the problem.
665