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