xref: /freebsd/usr.sbin/mountd/exports.5 (revision 295934eaa92cd917ae42a446899c0d527ad9c0c9)
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*295934eaSRick Macklem.Dd December 16, 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.
87*295934eaSRick MacklemIf the
88*295934eaSRick Macklem.Fl alldirs
89*295934eaSRick Macklemflag is specified and
90*295934eaSRick Macklemthe
91*295934eaSRick Macklem.Fl a
92*295934eaSRick Macklemcommand line option is specified for
93*295934eaSRick Macklem.Xr mountd 8 ,
94*295934eaSRick Macklemthe export will fail if the directory path is not a local file system
95*295934eaSRick Macklemmount point.
969d975e47SMark Johnston.Pp
979d975e47SMark JohnstonThere are three forms of the directory path specification.
988fae3551SRodney W. GrimesThe first is to list all mount points as absolute
998fae3551SRodney W. Grimesdirectory paths separated by whitespace.
100c95dfea9SRick MacklemThis list of directory paths should be considered an
101c95dfea9SRick Macklem.Dq administrative control ,
102c95dfea9SRick Macklemsince it is only enforced by the
103c95dfea9SRick Macklem.Xr mountd 8
104c95dfea9SRick Macklemdaemon and not the kernel.
105c95dfea9SRick MacklemAs such, it only applies to NFSv2 and NFSv3 mounts and only
106c95dfea9SRick Macklemwith respect to the client's use of the mount protocol.
1078fae3551SRodney W. GrimesThe second is to specify the pathname of the root of the file system
1088fae3551SRodney W. Grimesfollowed by the
1098fae3551SRodney W. Grimes.Fl alldirs
1108fae3551SRodney W. Grimesflag;
111a62dc406SDoug Rabsonthis form allows the host(s) to mount at any point within the file system,
11287564113SPeter Wemmincluding regular files if the
11387564113SPeter Wemm.Fl r
11491d299f5SKris Kennawayoption is used on
11591d299f5SKris Kennaway.Xr mountd 8 .
116c95dfea9SRick MacklemBecause NFSv4 does not use the mount protocol,
117c95dfea9SRick Macklemthe
118c95dfea9SRick Macklem.Dq administrative controls
11991095367SRick Macklemare not applied and all directories within this server
12091095367SRick Macklemfile system are mountable via NFSv4 even if the
121c95dfea9SRick Macklem.Fl alldirs
12291095367SRick Macklemflag has not been specified.
123bcc1d071SRick MacklemThe third form has the string ``V4:'' followed by a single absolute path
124580a9482SMaxim Konovalovname, to specify the NFSv4 tree root.
125c95dfea9SRick MacklemThis line does not export any file system, but simply marks where the root
126c95dfea9SRick Macklemof the server's directory tree is for NFSv4 clients.
127c95dfea9SRick MacklemThe exported file systems for NFSv4 are specified via the other lines
128c95dfea9SRick Macklemin the
1294d36343eSJoel Dahl.Nm
130c95dfea9SRick Macklemfile in the same way as for NFSv2 and NFSv3.
1318fae3551SRodney W. GrimesThe pathnames must not have any symbolic links in them and should not have
13280d9aed4SDaniel Gerzoany
13340873064SDaniel Gerzo.Dq Pa \&.
13480d9aed4SDaniel Gerzoor
13540873064SDaniel Gerzo.Dq Pa ..
13680d9aed4SDaniel Gerzocomponents.
137922e78f6SRick MacklemPathnames are decoded by
138922e78f6SRick Macklem.Xr strunvis 3
139922e78f6SRick Macklemallowing special characters to be included in the directory name(s).
140922e78f6SRick MacklemIn particular, whitespace, such as embedded blanks in directory names
141922e78f6SRick Macklemcan be handled.
142922e78f6SRick MacklemFor example, a blank can be encoded as \(rs040.
143922e78f6SRick Macklem.Xr vis 1
144922e78f6SRick Macklemwith the
145922e78f6SRick Macklem.Fl M
146922e78f6SRick Macklemoption may be used to encode directory name(s) with embedded special
147922e78f6SRick Macklemcharacters.
1488fae3551SRodney W. GrimesMount points for a file system may appear on multiple lines each with
1498fae3551SRodney W. Grimesdifferent sets of hosts and export options.
1508fae3551SRodney W. Grimes.Pp
1518fae3551SRodney W. GrimesThe second component of a line specifies how the file system is to be
1528fae3551SRodney W. Grimesexported to the host set.
1538fae3551SRodney W. GrimesThe option flags specify whether the file system
15440873064SDaniel Gerzois exported read-only or read-write and how the client UID is mapped to
1558fae3551SRodney W. Grimesuser credentials on the server.
1569acc400bSRick MacklemFor the NFSv4 tree root, the only options that can be specified in this
1579acc400bSRick Macklemsection are ones related to security:
1589acc400bSRick Macklem.Fl sec ,
1599acc400bSRick Macklem.Fl tls ,
1609acc400bSRick Macklem.Fl tlscert
1619acc400bSRick Macklemand
1629acc400bSRick Macklem.Fl tlscertuser .
1638fae3551SRodney W. Grimes.Pp
1648fae3551SRodney W. GrimesExport options are specified as follows:
1658fae3551SRodney W. Grimes.Pp
1668fae3551SRodney W. Grimes.Sm off
1676f8f0226SDaniel Gerzo.Fl maproot Li = Sy user
1688fae3551SRodney W. Grimes.Sm on
1698fae3551SRodney W. GrimesThe credential of the specified user is used for remote access by root.
1708fae3551SRodney W. GrimesThe credential includes all the groups to which the user is a member
1718fae3551SRodney W. Grimeson the local machine (see
1728fae3551SRodney W. Grimes.Xr id 1 ) .
1738fae3551SRodney W. GrimesThe user may be specified by name or number.
174b875c2e9SJosh PaetzelThe user string may be quoted, or use backslash escaping.
1758fae3551SRodney W. Grimes.Pp
1768fae3551SRodney W. Grimes.Sm off
1776f8f0226SDaniel Gerzo.Fl maproot Li = Sy user:group1:group2:...
1788fae3551SRodney W. Grimes.Sm on
1798fae3551SRodney W. GrimesThe colon separated list is used to specify the precise credential
1808fae3551SRodney W. Grimesto be used for remote access by root.
1818fae3551SRodney W. GrimesThe elements of the list may be either names or numbers.
1822ef608deSOlivier CertnerNote that
1832ef608deSOlivier Certner.Cm user:
1842ef608deSOlivier Certnershould be used to specify a credential containing no groups, in which case the
1852ef608deSOlivier Certnerestablished credential will use
1862ef608deSOlivier Certner.Ql nogroup ,
1872ef608deSOlivier Certnerelse 65533
1882ef608deSOlivier Certner.Pq Dv GID_NOGROUP ,
1892ef608deSOlivier Certneras the fallback group
1902ef608deSOlivier Certner.Pq a credential object must have at least one group internally .
1912ef608deSOlivier CertnerUsing just
1922ef608deSOlivier Certner.Cm user
1932ef608deSOlivier Certner.Pq without colon at end
1942ef608deSOlivier Certnerfalls into the
1952ef608deSOlivier Certner.Sm off
1962ef608deSOlivier Certner.Fl maproot Li = Sy user
1972ef608deSOlivier Certner.Sm on
1982ef608deSOlivier Certnercase described above.
199b875c2e9SJosh PaetzelThe group names may be quoted, or use backslash escaping.
2008fae3551SRodney W. Grimes.Pp
2018fae3551SRodney W. Grimes.Sm off
2026f8f0226SDaniel Gerzo.Fl mapall Li = Sy user
2038fae3551SRodney W. Grimes.Sm on
2048fae3551SRodney W. Grimesor
2058fae3551SRodney W. Grimes.Sm off
2066f8f0226SDaniel Gerzo.Fl mapall Li = Sy user:group1:group2:...
2078fae3551SRodney W. Grimes.Sm on
20840873064SDaniel Gerzospecifies a mapping for all client UIDs (including root)
2098fae3551SRodney W. Grimesusing the same semantics as
2108fae3551SRodney W. Grimes.Fl maproot .
2118fae3551SRodney W. Grimes.Pp
2128fae3551SRodney W. GrimesThe option
2138fae3551SRodney W. Grimes.Fl r
2148fae3551SRodney W. Grimesis a synonym for
2158fae3551SRodney W. Grimes.Fl maproot
2168fae3551SRodney W. Grimesin an effort to be backward compatible with older export file formats.
2178fae3551SRodney W. Grimes.Pp
2188fae3551SRodney W. GrimesIn the absence of
2198fae3551SRodney W. Grimes.Fl maproot
2208fae3551SRodney W. Grimesand
2218fae3551SRodney W. Grimes.Fl mapall
2226ab9e0dfSRick Macklemoptions, remote accesses by root will result in using a credential of 65534:65533.
2238fae3551SRodney W. GrimesAll other users will be mapped to their remote credential.
2248fae3551SRodney W. GrimesIf a
2258fae3551SRodney W. Grimes.Fl maproot
2268fae3551SRodney W. Grimesoption is given,
2276ab9e0dfSRick Macklemremote access by root will be mapped to that credential instead of 65534:65533.
2288fae3551SRodney W. GrimesIf a
2298fae3551SRodney W. Grimes.Fl mapall
2308fae3551SRodney W. Grimesoption is given,
2318fae3551SRodney W. Grimesall users (including root) will be mapped to that credential in
2328fae3551SRodney W. Grimesplace of their own.
2338fae3551SRodney W. Grimes.Pp
234a9148abdSDoug Rabson.Sm off
235a9148abdSDoug Rabson.Fl sec Li = Sy flavor1:flavor2...
236a9148abdSDoug Rabson.Sm on
237a9148abdSDoug Rabsonspecifies a colon separated list of acceptable security flavors to be
238a9148abdSDoug Rabsonused for remote access.
239a9148abdSDoug RabsonSupported security flavors are sys, krb5, krb5i and krb5p.
240a9148abdSDoug RabsonIf multiple flavors are listed, they should be ordered with the most
241a9148abdSDoug Rabsonpreferred flavor first.
242a9148abdSDoug RabsonIf this option is not present,
243a9148abdSDoug Rabsonthe default security flavor list of just sys is used.
244a9148abdSDoug Rabson.Pp
2458fae3551SRodney W. GrimesThe
2468fae3551SRodney W. Grimes.Fl ro
2478fae3551SRodney W. Grimesoption specifies that the file system should be exported read-only
2488fae3551SRodney W. Grimes(default read/write).
2498fae3551SRodney W. GrimesThe option
2508fae3551SRodney W. Grimes.Fl o
2518fae3551SRodney W. Grimesis a synonym for
2528fae3551SRodney W. Grimes.Fl ro
2538fae3551SRodney W. Grimesin an effort to be backward compatible with older export file formats.
2548fae3551SRodney W. Grimes.Pp
25574853402SPhilippe Charnier.Tn WebNFS
25674853402SPhilippe Charnierexports strictly according to the spec (RFC 2054 and RFC 2055) can
257cb3923e0SDoug Rabsonbe done with the
258cb3923e0SDoug Rabson.Fl public
259f63f700eSSheldon Hearnflag.
260f63f700eSSheldon HearnHowever, this flag in itself allows r/w access to all files in
26140873064SDaniel Gerzothe file system, not requiring reserved ports and not remapping UIDs.
262f63f700eSSheldon HearnIt
263cb3923e0SDoug Rabsonis only provided to conform to the spec, and should normally not be used.
26474853402SPhilippe CharnierFor a
26574853402SPhilippe Charnier.Tn WebNFS
26674853402SPhilippe Charnierexport,
267cb3923e0SDoug Rabsonuse the
268cb3923e0SDoug Rabson.Fl webnfs
269cb3923e0SDoug Rabsonflag, which implies
270cb3923e0SDoug Rabson.Fl public ,
271cb3923e0SDoug Rabson.Sm off
272cb3923e0SDoug Rabson.Fl mapall No = Sy nobody
273cb3923e0SDoug Rabson.Sm on
274cb3923e0SDoug Rabsonand
275cb3923e0SDoug Rabson.Fl ro .
276687c7280SCeri DaviesNote that only one file system can be
277687c7280SCeri Davies.Tn WebNFS
278687c7280SCeri Daviesexported on a server.
279cb3923e0SDoug Rabson.Pp
280cb3923e0SDoug RabsonA
281cb3923e0SDoug Rabson.Sm off
28210affec4SJoseph Koshy.Fl index No = Pa file
28374853402SPhilippe Charnier.Sm on
284cb3923e0SDoug Rabsonoption can be used to specify a file whose handle will be returned if
28594ba280cSRuslan Ermilova directory is looked up using the public filehandle
28694ba280cSRuslan Ermilov.Pq Tn WebNFS .
287f63f700eSSheldon HearnThis is to mimic the behavior of URLs.
288f63f700eSSheldon HearnIf no
289cb3923e0SDoug Rabson.Fl index
290cb3923e0SDoug Rabsonoption is specified, a directory filehandle will be returned as usual.
291cb3923e0SDoug RabsonThe
292cb3923e0SDoug Rabson.Fl index
293cb3923e0SDoug Rabsonoption only makes sense in combination with the
294cb3923e0SDoug Rabson.Fl public
295cb3923e0SDoug Rabsonor
296cb3923e0SDoug Rabson.Fl webnfs
297cb3923e0SDoug Rabsonflags.
298cb3923e0SDoug Rabson.Pp
2999acc400bSRick MacklemThe
3009acc400bSRick Macklem.Fl tls ,
3019acc400bSRick Macklem.Fl tlscert
3029acc400bSRick Macklemand
3039acc400bSRick Macklem.Fl tlscertuser
3049acc400bSRick Macklemexport options are used to require the client to use TLS for the mount(s)
305401c0f8aSRick Macklemper RFC 9289.
3069acc400bSRick MacklemFor NFS mounts using TLS to work,
3079acc400bSRick Macklem.Xr rpc.tlsservd 8
3089acc400bSRick Macklemmust be running on the server.
3099acc400bSRick Macklem.Bd -filled -offset indent
3109acc400bSRick Macklem.Fl tls
3119acc400bSRick Macklemrequires that the client use TLS.
3129acc400bSRick Macklem.br
3139acc400bSRick Macklem.Fl tlscert
3149acc400bSRick Macklemrequires that the client use TLS and provide a verifiable X.509 certificate
3159acc400bSRick Macklemduring TLS handshake.
3169acc400bSRick Macklem.br
3179acc400bSRick Macklem.Fl tlscertuser
3189acc400bSRick Macklemrequires that the client use TLS and provide a verifiable X.509 certificate.
3199acc400bSRick MacklemThe otherName component of the certificate's subjAltName must have a
3209acc400bSRick Mackleman OID of 1.3.6.1.4.1.2238.1.1.1 and a UTF8 string of the form
3219acc400bSRick Macklem.Dq user@domain .
3229acc400bSRick Macklem.Dq user@domain
3239acc400bSRick Macklemwill be translated to the credentials of the specified user in the same
3249acc400bSRick Macklemmanner as
3259acc400bSRick Macklem.Xr nfsuserd 8 ,
3269acc400bSRick Macklemwhere
3279acc400bSRick Macklem.Dq user
3289acc400bSRick Macklemis normally a username is the server's password database and
3299acc400bSRick Macklem.Dq domain
3309acc400bSRick Macklemis the DNS domain name for the server.
3319acc400bSRick MacklemAll RPCs will be performed using these credentials instead of the
3329acc400bSRick Macklemones in the RPC header in a manner similar to
3339acc400bSRick Macklem.Sm off
3349acc400bSRick Macklem.Fl mapall Li = Sy user .
3359acc400bSRick Macklem.Sm on
3369acc400bSRick Macklem.Ed
3379acc400bSRick Macklem.Pp
3389acc400bSRick MacklemIf none of these three flags are specified, TLS mounts are permitted but
3399acc400bSRick Macklemnot required.
3409acc400bSRick Macklem.Pp
341288fa14aSJoerg WunschSpecifying the
342288fa14aSJoerg Wunsch.Fl quiet
343288fa14aSJoerg Wunschoption will inhibit some of the syslog diagnostics for bad lines in
344288fa14aSJoerg Wunsch.Pa /etc/exports .
345288fa14aSJoerg WunschThis can be useful to avoid annoying error messages for known possible
346288fa14aSJoerg Wunschproblems (see
347288fa14aSJoerg Wunsch.Sx EXAMPLES
348288fa14aSJoerg Wunschbelow).
349288fa14aSJoerg Wunsch.Pp
3508fae3551SRodney W. GrimesThe third component of a line specifies the host set to which the line applies.
3518fae3551SRodney W. GrimesThe set may be specified in three ways.
3528fae3551SRodney W. GrimesThe first way is to list the host name(s) separated by white space.
35380d9aed4SDaniel Gerzo(Standard Internet
35480d9aed4SDaniel Gerzo.Dq dot
35580d9aed4SDaniel Gerzoaddresses may be used in place of names.)
35680d9aed4SDaniel GerzoThe second way is to specify a
35780d9aed4SDaniel Gerzo.Dq netgroup
35840873064SDaniel Gerzoas defined in the
35940873064SDaniel Gerzo.Pa netgroup
36040873064SDaniel Gerzofile (see
3618fae3551SRodney W. Grimes.Xr netgroup 5 ) .
36274853402SPhilippe CharnierThe third way is to specify an Internet subnetwork using a network and
3638fae3551SRodney W. Grimesnetwork mask that is defined as the set of all hosts with addresses within
3648fae3551SRodney W. Grimesthe subnetwork.
3658fae3551SRodney W. GrimesThis latter approach requires less overhead within the
3668fae3551SRodney W. Grimeskernel and is recommended for cases where the export line refers to a
3678fae3551SRodney W. Grimeslarge number of clients within an administrative subnet.
3688fae3551SRodney W. Grimes.Pp
3698fae3551SRodney W. GrimesThe first two cases are specified by simply listing the name(s) separated
3708fae3551SRodney W. Grimesby whitespace.
37180d9aed4SDaniel GerzoAll names are checked to see if they are
37280d9aed4SDaniel Gerzo.Dq netgroup
37380d9aed4SDaniel Gerzonames
3748fae3551SRodney W. Grimesfirst and are assumed to be hostnames otherwise.
3758fae3551SRodney W. GrimesUsing the full domain specification for a hostname can normally
3768fae3551SRodney W. Grimescircumvent the problem of a host that has the same name as a netgroup.
3778fae3551SRodney W. GrimesThe third case is specified by the flag
3788fae3551SRodney W. Grimes.Sm off
3796f8f0226SDaniel Gerzo.Fl network Li = Sy netname Op Li / Ar prefixlength
3808fae3551SRodney W. Grimes.Sm on
3818fae3551SRodney W. Grimesand optionally
3828fae3551SRodney W. Grimes.Sm off
3838fae3551SRodney W. Grimes.Fl mask No = Sy netmask .
3848fae3551SRodney W. Grimes.Sm on
38580d9aed4SDaniel GerzoThe netmask may be specified either by attaching a
38680d9aed4SDaniel Gerzo.Ar prefixlength
38780d9aed4SDaniel Gerzoto the
38880d9aed4SDaniel Gerzo.Fl network
38980d9aed4SDaniel Gerzooption, or by using a separate
39080d9aed4SDaniel Gerzo.Fl mask
39180d9aed4SDaniel Gerzooption.
39292aebdeaSMike KarelsIf the mask is not specified, it will default to the historical mask
39392aebdeaSMike Karelsfor that network class (A, B, or C; see
394906c1e27SMike Pritchard.Xr inet 4 ) .
39592aebdeaSMike KarelsThis usage is deprecated, and will elicit a warning log message.
396288fa14aSJoerg WunschSee the
397288fa14aSJoerg Wunsch.Sx EXAMPLES
398288fa14aSJoerg Wunschsection below.
3998fae3551SRodney W. Grimes.Pp
40080d9aed4SDaniel GerzoScoped IPv6 address must carry scope identifier as documented in
40180d9aed4SDaniel Gerzo.Xr inet6 4 .
40280d9aed4SDaniel GerzoFor example,
40340873064SDaniel Gerzo.Dq Li fe80::%re2/10
40440873064SDaniel Gerzois used to specify
40540873064SDaniel Gerzo.Li fe80::/10
40640873064SDaniel Gerzoon
40740873064SDaniel Gerzo.Li re2
40840873064SDaniel Gerzointerface.
40980d9aed4SDaniel Gerzo.Pp
410bcc1d071SRick MacklemFor the third form which specifies the NFSv4 tree root, the directory path
411bcc1d071SRick Macklemspecifies the location within the server's file system tree which is the
412bcc1d071SRick Macklemroot of the NFSv4 tree.
41391095367SRick MacklemThere can only be one NFSv4 root directory per server.
41491095367SRick MacklemAs such, all entries of this form must specify the same directory path.
415211024e9SRick MacklemFor file systems other than ZFS,
416211024e9SRick Macklemthis location can be any directory and does not
4176d6d6c36SGordon Berglingneed to be within an exported file system.
4186d6d6c36SGordon BerglingIf it is not in an exported file system, a very limited set of operations
4196d6d6c36SGordon Berglingare permitted, so that an NFSv4 client can traverse the tree to an
4206d6d6c36SGordon Berglingexported file system.
421bcc1d071SRick MacklemAlthough parts of the NFSv4 tree can be non-exported, the entire NFSv4 tree
422bcc1d071SRick Macklemmust consist of local file systems capable of being exported via NFS.
423211024e9SRick MacklemAll ZFS file systems in the subtree below the NFSv4 tree root must be
424211024e9SRick Macklemexported.
425bcc1d071SRick MacklemNFSv4 does not use the mount protocol and does permit clients to cross server
426bcc1d071SRick Macklemmount point boundaries, although not all clients are capable of crossing the
427bcc1d071SRick Macklemmount points.
428bcc1d071SRick Macklem.Pp
429bcc1d071SRick MacklemThe
430bcc1d071SRick Macklem.Fl sec
431bcc1d071SRick Macklemoption on these line(s) specifies what security flavors may be used for
4326d6d6c36SGordon BerglingNFSv4 operations that do not use file handles.
4336d6d6c36SGordon BerglingSince these operations (SetClientID, SetClientIDConfirm, Renew, DelegPurge
4346d6d6c36SGordon Berglingand ReleaseLockOnwer) allocate/modify state in the server, it is possible
4356d6d6c36SGordon Berglingto restrict some clients to the use of the krb5[ip] security flavors,
4366d6d6c36SGordon Berglingvia this option.
437bcc1d071SRick MacklemSee the
438bcc1d071SRick Macklem.Sx EXAMPLES
439bcc1d071SRick Macklemsection below.
440bcc1d071SRick MacklemThis third form is meaningless for NFSv2 and NFSv3 and is ignored for them.
441bcc1d071SRick Macklem.Pp
442288fa14aSJoerg WunschThe
443288fa14aSJoerg Wunsch.Xr mountd 8
444288fa14aSJoerg Wunschutility can be made to re-read the
445288fa14aSJoerg Wunsch.Nm
446288fa14aSJoerg Wunschfile by sending it a hangup signal as follows:
447288fa14aSJoerg Wunsch.Bd -literal -offset indent
44888d09ddeSMark Johnstonservice mountd reload
449288fa14aSJoerg Wunsch.Ed
450288fa14aSJoerg Wunsch.Pp
451288fa14aSJoerg WunschAfter sending the
452288fa14aSJoerg Wunsch.Dv SIGHUP ,
453288fa14aSJoerg Wunschcheck the
454288fa14aSJoerg Wunsch.Xr syslogd 8
455288fa14aSJoerg Wunschoutput to see whether
456288fa14aSJoerg Wunsch.Xr mountd 8
457288fa14aSJoerg Wunschlogged any parsing errors in the
458288fa14aSJoerg Wunsch.Nm
459288fa14aSJoerg Wunschfile.
460288fa14aSJoerg Wunsch.Sh FILES
461288fa14aSJoerg Wunsch.Bl -tag -width /etc/exports -compact
462288fa14aSJoerg Wunsch.It Pa /etc/exports
463288fa14aSJoerg Wunschthe default remote mount-point file
464288fa14aSJoerg Wunsch.El
465288fa14aSJoerg Wunsch.Sh EXAMPLES
466f9572577SMateusz PiotrowskiGiven that
467f9572577SMateusz Piotrowski.Pa /usr , /u , /a
468f9572577SMateusz Piotrowskiand
469f9572577SMateusz Piotrowski.Pa /u2
470f9572577SMateusz Piotrowskiare
471f9572577SMateusz Piotrowskilocal file system mount points, let's consider the following example:
472f9572577SMateusz Piotrowski.Pp
4738fae3551SRodney W. Grimes.Bd -literal -offset indent
4748fae3551SRodney W. Grimes/usr /usr/local -maproot=0:10 friends
4758fae3551SRodney W. Grimes/usr -maproot=daemon grumpy.cis.uoguelph.ca 131.104.48.16
4768fae3551SRodney W. Grimes/usr -ro -mapall=nobody
4778fae3551SRodney W. Grimes/u -maproot=bin: -network 131.104.48 -mask 255.255.255.0
47880d9aed4SDaniel Gerzo/a -network 192.168.0/24
47980d9aed4SDaniel Gerzo/a -network 3ffe:1ce1:1:fe80::/64
4808fae3551SRodney W. Grimes/u2 -maproot=root friends
481492d981bSMark Murray/u2 -alldirs -network cis-net -mask cis-mask
482288fa14aSJoerg Wunsch/cdrom -alldirs,quiet,ro -network 192.168.33.0 -mask 255.255.255.0
483a9148abdSDoug Rabson/private -sec=krb5i
484a9148abdSDoug Rabson/secret -sec=krb5p
485bcc1d071SRick MacklemV4: /	-sec=krb5:krb5i:krb5p -network 131.104.48 -mask 255.255.255.0
486bcc1d071SRick MacklemV4: /	-sec=sys:krb5:krb5i:krb5p grumpy.cis.uoguelph.ca
4878fae3551SRodney W. Grimes.Ed
4888fae3551SRodney W. Grimes.Pp
489f9572577SMateusz PiotrowskiThe file systems rooted at
490f9572577SMateusz Piotrowski.Pa /usr
4918fae3551SRodney W. Grimesand
492f9572577SMateusz Piotrowski.Pa /usr/local
493f9572577SMateusz Piotrowskiare exported to hosts within the
494f9572577SMateusz Piotrowski.Dq friends
495f9572577SMateusz Piotrowskinetwork group
496f9572577SMateusz Piotrowskiwith users mapped to their remote credentials and
497f9572577SMateusz Piotrowskiroot mapped to UID 0 and group 10.
498f9572577SMateusz PiotrowskiThey are exported read-write and the hosts in
499f9572577SMateusz Piotrowski.Dq friends .
50088b3d518SDavid E. O'Brien.Pp
50140873064SDaniel GerzoThe file system rooted at
50210affec4SJoseph Koshy.Pa /usr
503f9572577SMateusz Piotrowskiis exported to
5048fae3551SRodney W. Grimes.Em 131.104.48.16
5058fae3551SRodney W. Grimesand
5068fae3551SRodney W. Grimes.Em grumpy.cis.uoguelph.ca
5078fae3551SRodney W. Grimeswith users mapped to their remote credentials and
50880d9aed4SDaniel Gerzoroot mapped to the user and groups associated with
50980d9aed4SDaniel Gerzo.Dq daemon ;
5108fae3551SRodney W. Grimesit is exported to the rest of the world as read-only with
51180d9aed4SDaniel Gerzoall users mapped to the user and groups associated with
51280d9aed4SDaniel Gerzo.Dq nobody .
5138fae3551SRodney W. Grimes.Pp
51440873064SDaniel GerzoThe file system rooted at
51510affec4SJoseph Koshy.Pa /u
5168fae3551SRodney W. Grimesis exported to all hosts on the subnetwork
5178fae3551SRodney W. Grimes.Em 131.104.48
51840873064SDaniel Gerzowith root mapped to the UID for
51980d9aed4SDaniel Gerzo.Dq bin
52080d9aed4SDaniel Gerzoand with no group access.
5218fae3551SRodney W. Grimes.Pp
52240873064SDaniel GerzoThe file system rooted at
52310affec4SJoseph Koshy.Pa /u2
52480d9aed4SDaniel Gerzois exported to the hosts in
52580d9aed4SDaniel Gerzo.Dq friends
52640873064SDaniel Gerzowith root mapped to UID and groups
52780d9aed4SDaniel Gerzoassociated with
52880d9aed4SDaniel Gerzo.Dq root ;
52980d9aed4SDaniel Gerzoit is exported to all hosts on network
53080d9aed4SDaniel Gerzo.Dq cis-net
53180d9aed4SDaniel Gerzoallowing mounts at any
532492d981bSMark Murraydirectory within /u2.
5332f47c461SSheldon Hearn.Pp
53440873064SDaniel GerzoThe file system rooted at
53580d9aed4SDaniel Gerzo.Pa /a
53680d9aed4SDaniel Gerzois exported to the network 192.168.0.0, with a netmask of 255.255.255.0.
53740873064SDaniel GerzoHowever, the netmask length in the entry for
53880d9aed4SDaniel Gerzo.Pa /a
53940873064SDaniel Gerzois not specified through a
54040873064SDaniel Gerzo.Fl mask
54140873064SDaniel Gerzooption, but through the
54240873064SDaniel Gerzo.Li / Ns Ar prefix
54340873064SDaniel Gerzonotation.
54440873064SDaniel Gerzo.Pp
54540873064SDaniel GerzoThe file system rooted at
54640873064SDaniel Gerzo.Pa /a
54740873064SDaniel Gerzois also exported to the IPv6 network
54840873064SDaniel Gerzo.Li 3ffe:1ce1:1:fe80::
54940873064SDaniel Gerzoaddress, using the upper 64 bits as the prefix.
55080d9aed4SDaniel GerzoNote that, unlike with IPv4 network addresses, the specified network
55180d9aed4SDaniel Gerzoaddress must be complete, and not just contain the upper bits.
55240873064SDaniel GerzoWith IPv6 addresses, the
55340873064SDaniel Gerzo.Fl mask
55440873064SDaniel Gerzooption must not be used.
55580d9aed4SDaniel Gerzo.Pp
556288fa14aSJoerg WunschThe file system rooted at
55710affec4SJoseph Koshy.Pa /cdrom
55840873064SDaniel Gerzowill be exported read-only to the entire network 192.168.33.0/24, including
559288fa14aSJoerg Wunschall its subdirectories.
560288fa14aSJoerg WunschSince
56110affec4SJoseph Koshy.Pa /cdrom
562*295934eaSRick Macklemis the conventional mountpoint for a CD-ROM device,
563*295934eaSRick Macklemfor the case where the
564*295934eaSRick Macklem.Fl a
565*295934eaSRick Macklemoption has been specified for
566*295934eaSRick Macklem.Xr mountd 8 ,
567*295934eaSRick Macklemthis export will
568*295934eaSRick Macklemfail if no CD-ROM medium is currently mounted there
569*295934eaSRick Macklemsince that line
570288fa14aSJoerg Wunschwould then attempt to export a subdirectory of the root file system
571288fa14aSJoerg Wunschwith the
572288fa14aSJoerg Wunsch.Fl alldirs
573*295934eaSRick Macklemoption.
5742f47c461SSheldon HearnThe
575288fa14aSJoerg Wunsch.Fl quiet
576288fa14aSJoerg Wunschoption will then suppress the error message for this condition that
577288fa14aSJoerg Wunschwould normally be syslogged.
578288fa14aSJoerg WunschAs soon as an actual CD-ROM is going to be mounted,
579288fa14aSJoerg Wunsch.Xr mount 8
580288fa14aSJoerg Wunschwill notify
5812f47c461SSheldon Hearn.Xr mountd 8
582288fa14aSJoerg Wunschabout this situation, and the
58310affec4SJoseph Koshy.Pa /cdrom
58457bd0fc6SJens Schweikhardtfile system will be exported as intended.
585288fa14aSJoerg WunschNote that without using the
586288fa14aSJoerg Wunsch.Fl alldirs
587288fa14aSJoerg Wunschoption, the export would always succeed.
588288fa14aSJoerg WunschWhile there is no CD-ROM medium mounted under
58910affec4SJoseph Koshy.Pa /cdrom ,
590288fa14aSJoerg Wunschit would export the (normally empty) directory
59110affec4SJoseph Koshy.Pa /cdrom
592288fa14aSJoerg Wunschof the root file system instead.
593a9148abdSDoug Rabson.Pp
594a9148abdSDoug RabsonThe file system rooted at
595a9148abdSDoug Rabson.Pa /private
596a9148abdSDoug Rabsonwill be exported using Kerberos 5 authentication and will require
597a9148abdSDoug Rabsonintegrity protected messages for all accesses.
598a9148abdSDoug RabsonThe file system rooted at
599a9148abdSDoug Rabson.Pa /secret
600a9148abdSDoug Rabsonwill also be exported using Kerberos 5 authentication and all messages
601a9148abdSDoug Rabsonused to access it will be encrypted.
602bcc1d071SRick Macklem.Pp
603bcc1d071SRick MacklemFor the experimental server, the NFSv4 tree is rooted at ``/'',
604bcc1d071SRick Macklemand any client within the 131.104.48 subnet is permitted to perform NFSv4 state
605bcc1d071SRick Macklemoperations on the server, so long as valid Kerberos credentials are provided.
606bcc1d071SRick MacklemThe machine grumpy.cis.uoguelph.ca is permitted to perform NFSv4 state
607bcc1d071SRick Macklemoperations on the server using AUTH_SYS credentials, as well as Kerberos ones.
608aa255a10SMartin Cracauer.Pp
609aa255a10SMartin CracauerIn the following example some directories are exported as NFSv3 and NFSv4:
610aa255a10SMartin Cracauer.Bd -literal -offset indent
611aa255a10SMartin CracauerV4: /wingsdl/nfsv4
612aa255a10SMartin Cracauer/wingsdl/nfsv4/usr-ports -maproot=root -network 172.16.0.0 -mask 255.255.0.0
613aa255a10SMartin Cracauer/wingsdl/nfsv4/clasper   -maproot=root clasper
614aa255a10SMartin Cracauer.Ed
615aa255a10SMartin Cracauer.Pp
616aa255a10SMartin CracauerOnly one V4: line is needed or allowed to declare where NFSv4 is
6176d6d6c36SGordon Berglingrooted.
6186d6d6c36SGordon BerglingThe other lines declare specific exported directories with
619aa255a10SMartin Cracauertheir absolute paths given in /etc/exports.
620aa255a10SMartin Cracauer.Pp
621aa255a10SMartin CracauerThe exported directories' paths are used for both v3 and v4.
6226d6d6c36SGordon BerglingHowever, they are interpreted differently for v3 and v4.
6236d6d6c36SGordon BerglingA client mount command for usr-ports would use the server-absolute name when
624aa255a10SMartin Cracauerusing nfsv3:
625aa255a10SMartin Cracauer.Bd -literal -offset indent
626aa255a10SMartin Cracauermount server:/wingsdl/nfsv4/usr-ports /mnt/tmp
627aa255a10SMartin Cracauer.Ed
628aa255a10SMartin Cracauer.Pp
629aa255a10SMartin CracauerA mount command using NFSv4 would use the path relative to the NFSv4
630aa255a10SMartin Cracauerroot:
631aa255a10SMartin Cracauer.Bd -literal -offset indent
632aa255a10SMartin Cracauermount server:/usr-ports /mnt/tmp
633aa255a10SMartin Cracauer.Ed
634aa255a10SMartin Cracauer.Pp
635aa255a10SMartin CracauerThis also differentiates which version you want if the client can do
6366d6d6c36SGordon Berglingboth v3 and v4.
6376d6d6c36SGordon BerglingThe former will only ever do a v3 mount and the latter will only ever
6386d6d6c36SGordon Berglingdo a v4 mount.
639aa255a10SMartin Cracauer.Pp
640aa255a10SMartin CracauerNote that due to different mount behavior between NFSv3 and NFSv4 a
641aa255a10SMartin CracauerNFSv4 mount request for a directory that the client does not have
642aa255a10SMartin Cracauerpermission for will succeed and read/write access will fail
643aa255a10SMartin Cracauerafterwards, whereas NFSv3 rejects the mount request.
6448fae3551SRodney W. Grimes.Sh SEE ALSO
645922e78f6SRick Macklem.Xr vis 1 ,
646922e78f6SRick Macklem.Xr strunvis 3 ,
647639e19ecSEdward Tomasz Napierala.Xr nfsv4 4 ,
6488fae3551SRodney W. Grimes.Xr netgroup 5 ,
6499d975e47SMark Johnston.Xr zfsprops 7 ,
6508fae3551SRodney W. Grimes.Xr mountd 8 ,
6518fae3551SRodney W. Grimes.Xr nfsd 8 ,
6529acc400bSRick Macklem.Xr rpc.tlsservd 8 ,
65388d09ddeSMark Johnston.Xr service 8 ,
6548fae3551SRodney W. Grimes.Xr showmount 8
6559acc400bSRick Macklem.Sh STANDARDS
656f9572577SMateusz PiotrowskiThe implementation is based on the following documents:
657f9572577SMateusz Piotrowski.Bl -dash
658f9572577SMateusz Piotrowski.It
6599acc400bSRick Macklem.Rs
6609acc400bSRick Macklem.%T "Network File System Protocol Specification, Appendix A, RFC 1094"
661f9572577SMateusz Piotrowski.Re
662f9572577SMateusz Piotrowski.It
663f9572577SMateusz Piotrowski.Rs
6649acc400bSRick Macklem.%T "NFS: Network File System Version 3, Appendix I, RFC 1813"
665f9572577SMateusz Piotrowski.Re
666f9572577SMateusz Piotrowski.It
667f9572577SMateusz Piotrowski.Rs
668401c0f8aSRick Macklem.%T "Towards Remote Procedure Call Encryption by Default, RFC 9289"
6699acc400bSRick Macklem.Re
670f9572577SMateusz Piotrowski.El
6718fae3551SRodney W. Grimes.Sh BUGS
6728fae3551SRodney W. GrimesThe export options are tied to the local mount points in the kernel and
6738fae3551SRodney W. Grimesmust be non-contradictory for any exported subdirectory of the local
6748fae3551SRodney W. Grimesserver mount point.
6758fae3551SRodney W. GrimesIt is recommended that all exported directories within the same server
6768fae3551SRodney W. Grimesfile system be specified on adjacent lines going down the tree.
6778fae3551SRodney W. GrimesYou cannot specify a hostname that is also the name of a netgroup.
6788fae3551SRodney W. GrimesSpecifying the full domain specification for a hostname can normally
6798fae3551SRodney W. Grimescircumvent the problem.
680