xref: /freebsd/usr.sbin/mountd/mountd.8 (revision 0e8011faf58b743cc652e3b2ad0f7671227610df)
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.\" 3. 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.Dd December 16, 2024
29.Dt MOUNTD 8
30.Os
31.Sh NAME
32.Nm mountd
33.Nd service remote
34.Tn NFS
35mount requests
36.Sh SYNOPSIS
37.Nm
38.Op Fl 2AadelNnRrSs
39.Op Fl h Ar bindip
40.Op Fl p Ar port
41.Op Ar exportsfile ...
42.Sh DESCRIPTION
43The
44.Nm
45utility is the server for
46.Tn NFS
47mount requests from other client machines.
48It listens for service requests at the port indicated in the
49.Tn NFS
50server specification; see
51.%T "Network File System Protocol Specification" ,
52RFC1094, Appendix A and
53.%T "NFS: Network File System Version 3 Protocol Specification" ,
54RFC1813, Appendix I.
55.Pp
56The following options are available:
57.Bl -tag -width indent
58.It Fl 2
59Allow the administrator to force clients to use only the
60version 2
61.Tn NFS
62protocol to mount file systems from this server.
63.It Fl A
64Silence the warnings related to
65.Dq administrative controls .
66These warnings remind users that an exported
67.Dq administrative control
68directory that is not a local server file system mount point
69actually exports the entire local file system and not just
70the subtree below the directory exported.
71(See
72.Xr exports 5 )
73.It Fl a
74Enforce the check for an exported directory being a file
75system mount point, if the
76.Fl -alldirs
77option is specified in
78.Xr exports 5
79for the export file line.
80With this option, the exports line will fail, whereas
81without this option, a warning will be generated by
82.Xr syslog 8 ,
83but the export will be done.
84.It Fl d
85Output debugging information.
86.Nm
87will not detach from the controlling terminal and will print
88debugging messages to stderr.
89.It Fl e
90Ignored; included for backward compatibility.
91.It Fl h Ar bindip
92Specify specific IP addresses to bind to for TCP and UDP requests.
93This option may be specified multiple times.
94If no
95.Fl h
96option is specified,
97.Nm
98will bind to
99.Dv INADDR_ANY .
100Note that when specifying IP addresses with
101.Fl h ,
102.Nm
103will automatically add
104.Li 127.0.0.1
105and if IPv6 is enabled,
106.Li ::1
107to the list.
108.It Fl l
109Cause all succeeded
110.Nm
111requests to be logged.
112.It Fl N
113Cause
114.Nm
115to execute in the foreground instead of in daemon mode.
116.It Fl n
117Allow non-root mount requests to be served.
118This should only be specified if there are clients such as PC's,
119that require it.
120It will automatically clear the vfs.nfsd.nfs_privport sysctl flag, which
121controls if the kernel will accept NFS requests from reserved ports only.
122.It Fl p Ar port
123Force
124.Nm
125to bind to the specified port, for both
126.Dv AF_INET
127and
128.Dv AF_INET6
129address families.
130This is typically done to ensure that the port which
131.Nm
132binds to is a known quantity which can be used in firewall rulesets.
133If
134.Nm
135cannot bind to this port, an appropriate error will be recorded in
136the system log, and the daemon will then exit.
137.It Fl R
138Do not support the Mount protocol and do not register with
139.Xr rpcbind 8 .
140This can be done for NFSv4 only servers, since the Mount protocol is not
141used by NFSv4.
142Useful for NFSv4 only servers that do not wish to run
143.Xr rpcbind 8 .
144.Xr showmount 8
145will not work, however since NFSv4 mounts are not shown by
146.Xr showmount 8 ,
147this should not be an issue for an NFSv4 only server.
148.It Fl r
149Allow mount RPCs requests for regular files to be served.
150Although this seems to violate the mount protocol specification,
151some diskless workstations do mount requests for
152their swapfiles and expect them to be regular files.
153Since a regular file cannot be specified in
154.Pa /etc/exports ,
155the entire file system in which the swapfiles resides
156will have to be exported with the
157.Fl alldirs
158flag.
159.It Ar exportsfile
160Specify an alternate location
161for the exports file.
162More than one exports file can be specified.
163.It Fl S
164Tell mountd to suspend/resume execution of the nfsd threads whenever
165the exports list is being reloaded.
166This avoids intermittent access
167errors for clients that do NFS RPCs while the exports are being
168reloaded, but introduces a delay in RPC response while the reload
169is in progress.
170If
171.Nm
172crashes while an exports load is in progress,
173.Nm
174must be restarted to get the nfsd threads running again, if this
175option is used.
176.It Fl s
177Cause
178.Nm
179to skip automatic binding to localhost for IPv4 and IPv6.
180This option is meaningless unless
181.Fl h
182has also been used.
183.El
184.Pp
185When
186.Nm
187is started,
188it loads the export host addresses and options into the kernel
189using the
190.Xr nmount 2
191system call.
192After changing the exports file,
193a hangup signal should be sent to the
194.Nm
195daemon
196to get it to reload the export information.
197After sending the SIGHUP
198(kill \-s HUP `cat /var/run/mountd.pid`),
199check the syslog output to see if
200.Nm
201logged any parsing
202errors in the exports file.
203.Pp
204If multiple instances of
205.Nm
206are being run, either in multiple jails or both within
207and outside of a jail, care must be taken to export
208any given file system in only one of the instances.
209Note that the
210.Va allow.nfsd
211jail parameter is required to allow
212.Nm
213to run in a jail.
214See
215.Xr jail 8
216for more information.
217.Pp
218If
219.Nm
220detects that the running kernel does not include
221.Tn NFS
222support, it will attempt to load a loadable kernel module containing
223.Tn NFS
224code, using
225.Xr kldload 2 .
226If this fails, or no
227.Tn NFS
228KLD was available,
229.Nm
230exits with an error.
231When run in a jail, the
232.Xr kldload 2
233must be done outside the jail, typically by adding
234.Dq nfsd
235to
236.Va kld_list
237in the
238.Xr rc.conf 5
239file on the jail host.
240.Sh FILES
241.Bl -tag -width /var/run/mountd.pid -compact
242.It Pa /etc/exports
243the list of exported file systems
244.It Pa /var/run/mountd.pid
245the pid of the currently running mountd
246.It Pa /var/db/mountdtab
247the current list of remote mounted file systems
248.El
249.Sh SEE ALSO
250.Xr nfsstat 1 ,
251.Xr kldload 2 ,
252.Xr nfsv4 4 ,
253.Xr exports 5 ,
254.Xr rc.conf 5 ,
255.Xr jail 8 ,
256.Xr nfsd 8 ,
257.Xr rpcbind 8 ,
258.Xr showmount 8 ,
259.Xr syslog 8
260.Sh HISTORY
261The
262.Nm
263utility first appeared in
264.Bx 4.4 .
265