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