]> git.decadent.org.uk Git - nfs-utils.git/blob - utils/exportfs/exports.man
97264cdc6511880f69ed3d00a0c092043b1abffd
[nfs-utils.git] / utils / exportfs / exports.man
1 .TH EXPORTS 5 "28 October 1999"
2 .UC 5
3 .SH NAME
4 exports \- NFS file systems being exported (for Kernel based NFS)
5 .SH SYNOPSIS
6 .B /etc/exports
7 .SH DESCRIPTION
8 The file
9 .I /etc/exports
10 serves as the access control list for file systems which may be
11 exported to NFS clients.  It is used by
12 .IR exportfs (8)
13 to give information to
14 .IR mountd (8)
15 and to the kernel based NFS file server daemon
16 .IR nfsd (8).
17 .PP
18 The file format is similar to the SunOS
19 .I exports
20 file. Each line contains an export point and a whitespace-separated list
21 of clients allowed to mount the file system at that point. Each listed
22 client may be immediately followed by a parenthesized, comma-separated
23 list of export options for that client. No whitespace is permitted
24 between a client and its option list.
25 .PP
26 Blank lines are ignored.  A pound sign ("#") introduces a comment to the
27 end of the line. Entries may be continued across newlines using a
28 backslash. If an export name contains spaces it should be quoted using
29 double quotes. You can also specify spaces or other unusual character in
30 the export name using a backslash followed by the character code as three
31 octal digits.
32 .PP
33 .SS Machine Name Formats
34 NFS clients may be specified in a number of ways:
35 .IP "single host
36 This is the most common format. You may specify a host either by an
37 abbreviated name recognized be the resolver, the fully qualified domain
38 name, or an IP address.
39 .IP "netgroups
40 NIS netgroups may be given as
41 .IR @group .
42 Only the host part of each
43 netgroup members is consider in checking for membership.  Empty host
44 parts or those containing a single dash (\-) are ignored.
45 .IP "wildcards
46 Machine names may contain the wildcard characters \fI*\fR and \fI?\fR.
47 This can be used to make the \fIexports\fR file more compact; for instance,
48 \fI*.cs.foo.edu\fR matches all hosts in the domain \fIcs.foo.edu\fR. However,
49 these wildcard characters do not match the dots in a domain name, so the
50 above pattern does not include hosts such as \fIa.b.cs.foo.edu\fR.
51 .IP "IP networks
52 You can also export directories to all hosts on an IP (sub-) network
53 simultaneously. This is done by specifying an IP address and netmask pair
54 as
55 .IR address/netmask
56 where the netmask can be specified in dotted-decimal format, or as a
57 contiguous mask length (for example, either `/255.255.252.0' or `/22' appended
58 to the network base address result in identical subnetworks with 10 bits of
59 host). Wildcard characters generally do not work on IP addresses, though they
60 may work by accident when reverse DNS lookups fail.
61 '''.TP
62 '''.B =public
63 '''This is a special ``hostname'' that identifies the given directory name
64 '''as the public root directory (see the section on WebNFS in
65 '''.BR nfsd (8)
66 '''for a discussion of WebNFS and the public root handle). When using this
67 '''convention,
68 '''.B =public
69 '''must be the only entry on this line, and must have no export options
70 '''associated with it. Note that this does
71 '''.I not
72 '''actually export the named directory; you still have to set the exports
73 '''options in a separate entry.
74 '''.PP
75 '''The public root path can also be specified by invoking
76 '''.I nfsd
77 '''with the
78 '''.B \-\-public\-root
79 '''option. Multiple specifications of a public root will be ignored.
80 .PP
81 .SS General Options
82 .IR exportfs
83 understands the following export options:
84 .TP
85 .IR secure "\*d
86 This option requires that requests originate on an internet port less
87 than IPPORT_RESERVED (1024). This option is on by default. To turn it
88 off, specify
89 .IR insecure .
90 .TP
91 .IR rw
92 Allow both read and write requests on this NFS volume. The
93 default is to disallow any request which changes the filesystem.
94 This can also be made explicit by using
95 the
96 .IR ro " option.
97 .TP
98 .IR async
99 This option allows the NFS server to violate the NFS protocol and
100 reply to requests before any changes made by that request have been
101 committed to stable storage (e.g. disc drive).
102
103 Using this option usually improves performance, but at the cost that
104 an unclean server restart (i.e. a crash) can cause data to be lost or
105 corrupted.
106
107 In releases of nfs-utils upto and including 1.0.0, this option was the
108 default.  In this and future releases,
109 .I sync
110 is the default, and
111 .I async
112 must be explicit requested if needed.
113 To help make system adminstrators aware of this change, 'exportfs'
114 will issue a warning if neither
115 .I sync
116 nor
117 .I async
118 is specified.
119 .TP
120 .IR no_wdelay
121 This option has no effect if
122 .I async
123 is also set.  The NFS server will normally delay committing a write request
124 to disc slightly if it suspects that another related write request may be in
125 progress or may arrive soon.  This allows multiple write requests to
126 be committed to disc with the one operation which can improve
127 performance.  If an NFS server received mainly small unrelated
128 requests, this behaviour could actually reduce performance, so
129 .IR no_wdelay
130 is available to turn it off.
131 The default can be explicitly requested with the
132 .IR wdelay " option.
133 .TP
134 .IR nohide
135 This option is based on the option of the same name provided in IRIX
136 NFS.  Normally, if a server exports two filesystems one of which is
137 mounted on the other, then the client will have to mount both
138 filesystems explicitly to get access to them.  If it just mounts the
139 parent, it will see an empty directory at the place where the other
140 filesystem is mounted.  That filesystem is "hidden".
141
142 Setting the
143 .I nohide
144 option on a filesystem causes it not to be hidden, and an
145 appropriately authorised client will be able to move from the parent to
146 that filesystem without noticing the change.
147
148 However, some NFS clients do not cope well with this situation as, for
149 instance, it is then possible for two files in the one apparent
150 filesystem to have the same inode number.
151
152 The
153 .I nohide
154 option is currently only effective on
155 .I "single host
156 exports.  It does not work reliably with netgroup, subnet, or wildcard
157 exports. 
158
159 This option can be very useful in some situations, but it should be
160 used with due care, and only after confirming that the client system
161 copes with the situation effectively.
162
163 The option can be explicitly disabled with
164 .IR hide .
165 .TP
166 .IR no_subtree_check
167 This option disables subtree checking, which has mild security
168 implications, but can improve reliability is some circumstances.
169
170 If a subdirectory of a filesystem is exported, but the whole
171 filesystem isn't then whenever a NFS request arrives, the server must
172 check not only that the accessed file is in the appropriate filesystem
173 (which is easy) but also that it is in the exported tree (which is
174 harder). This check is called the
175 .IR subtree_check .
176
177 In order to perform this check, the server must include some
178 information about the location of the file in the "filehandle" that is
179 given to the client.  This can cause problems with accessing files that
180 are renamed while a client has them open (though in many simple cases
181 it will still work).
182
183 subtree checking is also used to make sure that files inside
184 directories to which only root has access can only be accessed if the
185 filesystem is exported with
186 .I no_root_squash
187 (see below), even the file itself allows more general access.
188
189 As a general guide, a home directory filesystem, which is normally
190 exported at the root and may see lots of file renames, should be
191 exported with subtree checking disabled.  A filesystem which is mostly
192 readonly, and at least doesn't see many file renames (e.g. /usr or
193 /var) and for which subdirectories may be exported, should probably be
194 exported with subtree checks enabled.
195
196 The default of having subtree checks enabled, can be explicitly
197 requested with
198 .IR subtree_check .
199
200 .TP
201 .IR insecure_locks
202 .TP
203 .IR no_auth_nlm
204 This option (the two names are synonymous) tells the NFS server not to require authentication of
205 locking requests (i.e. requests which use the NLM protocol).  Normally
206 the NFS server will require a lock request to hold a credential for a
207 user who has read access to the file.  With this flag no access checks
208 will be performed.
209
210 Early NFS client implementations did not send credentials with lock
211 requests, and many current NFS clients still exist which are based on
212 the old implementations.  Use this flag if you find that you can only
213 lock files which are world readable.
214
215 The default behaviour of requiring authentication for NLM requests can
216 be explicitly requested with either of the synonymous
217 .IR auth_nlm ,
218 or
219 .IR secure_locks .
220
221 '''.TP
222 '''.I noaccess
223 '''This makes everything below the directory inaccessible for the named
224 '''client.  This is useful when you want to export a directory hierarchy to
225 '''a client, but exclude certain subdirectories. The client's view of a
226 '''directory flagged with noaccess is very limited; it is allowed to read
227 '''its attributes, and lookup `.' and `..'. These are also the only entries
228 '''returned by a readdir.
229 '''.TP
230 '''.IR link_relative
231 '''Convert absolute symbolic links (where the link contents start with a
232 '''slash) into relative links by prepending the necessary number of ../'s
233 '''to get from the directory containing the link to the root on the
234 '''server.  This has subtle, perhaps questionable, semantics when the file
235 '''hierarchy is not mounted at its root.
236 '''.TP
237 '''.IR link_absolute
238 '''Leave all symbolic link as they are. This is the default operation.
239 .SS User ID Mapping
240 .PP
241 .I nfsd
242 bases its access control to files on the server machine on the uid and
243 gid provided in each NFS RPC request. The normal behavior a user would
244 expect is that she can access her files on the server just as she would
245 on a normal file system. This requires that the same uids and gids are
246 used on the client and the server machine. This is not always true, nor
247 is it always desirable.
248 .PP
249 Very often, it is not desirable that the root user on a client machine
250 is also treated as root when accessing files on the NFS server. To this
251 end, uid 0 is normally mapped to a different id: the so-called
252 anonymous or
253 .I nobody
254 uid. This mode of operation (called `root squashing') is the default,
255 and can be turned off with
256 .IR no_root_squash .
257 .PP
258 By default,
259 '''.I nfsd
260 '''tries to obtain the anonymous uid and gid by looking up user
261 '''.I nobody
262 '''in the password file at startup time. If it isn't found, a uid and gid
263 .I exportfs
264 chooses a uid and gid
265 of -2 (i.e. 65534) for squashed access. These values can also be overridden by
266 the
267 .IR anonuid " and " anongid
268 options.
269 '''.PP
270 '''In addition to this, 
271 '''.I nfsd
272 '''lets you specify arbitrary uids and gids that should be mapped to user
273 '''nobody as well.
274 Finally, you can map all user requests to the
275 anonymous uid by specifying the
276 .IR all_squash " option.
277 '''.PP 
278 '''For the benefit of installations where uids differ between different
279 '''machines, 
280 '''.I nfsd
281 '''provides several mechanism to dynamically map server uids to client
282 '''uids and vice versa: static mapping files, NIS-based mapping, and
283 '''.IR ugidd -based
284 '''mapping.
285 '''.PP
286 '''.IR ugidd -based
287 '''mapping is enabled with the 
288 '''.I map_daemon
289 '''option, and uses the UGID RPC protocol. For this to work, you have to run
290 '''the
291 '''.IR ugidd (8)
292 '''mapping daemon on the client host. It is the least secure of the three methods,
293 '''because by running
294 '''.IR ugidd ,
295 '''everybody can query the client host for a list of valid user names. You
296 '''can protect yourself by restricting access to
297 '''.I ugidd
298 '''to valid hosts only. This can be done by entering the list of valid
299 '''hosts into the
300 '''.I hosts.allow
301 '''or 
302 '''.I hosts.deny
303 '''file. The service name is
304 '''.IR ugidd .
305 '''For a description of the file's syntax, please read
306 '''.IR hosts_access (5).
307 '''.PP
308 '''Static mapping is enabled by using the
309 '''.I map_static
310 '''option, which takes a file name as an argument that describes the mapping.
311 '''NIS-based mapping queries the client's NIS server to obtain a mapping from
312 '''user and group names on the server host to user and group names on the
313 '''client.
314 .PP
315 Here's the complete list of mapping options:
316 .TP
317 .IR root_squash
318 Map requests from uid/gid 0 to the anonymous uid/gid. Note that this does
319 not apply to any other uids that might be equally sensitive, such as user
320 .IR bin .
321 .TP
322 .IR no_root_squash
323 Turn off root squashing. This option is mainly useful for diskless clients.
324 '''.TP
325 '''.IR squash_uids " and " squash_gids
326 '''This option specifies a list of uids or gids that should be subject to
327 '''anonymous mapping. A valid list of ids looks like this:
328 '''.IP
329 '''.IR squash_uids=0-15,20,25-50
330 '''.IP
331 '''Usually, your squash lists will look a lot simpler.
332 .TP
333 .IR all_squash
334 Map all uids and gids to the anonymous user. Useful for NFS-exported
335 public FTP directories, news spool directories, etc. The opposite option
336 is 
337 .IR no_all_squash ,
338 which is the default setting.
339 '''.TP
340 '''.IR map_daemon
341 '''This option turns on dynamic uid/gid mapping. Each uid in an NFS request
342 '''will be translated to the equivalent server uid, and each uid in an
343 '''NFS reply will be mapped the other way round. This option requires that
344 '''.IR rpc.ugidd (8)
345 '''runs on the client host. The default setting is
346 '''.IR map_identity ,
347 '''which leaves all uids untouched. The normal squash options apply regardless
348 '''of whether dynamic mapping is requested or not.
349 '''.TP
350 '''.IR map_static
351 '''This option enables static mapping. It specifies the name of the file
352 '''that describes the uid/gid mapping, e.g.
353 '''.IP
354 '''.IR map_static=/etc/nfs/foobar.map
355 '''.IP
356 '''The file's format looks like this
357 '''.IP
358 '''.nf
359 '''.ta +3i
360 '''# Mapping for client foobar:
361 '''#    remote     local
362 '''uid  0-99       -       # squash these
363 '''uid  100-500    1000    # map 100-500 to 1000-1400
364 '''gid  0-49       -       # squash these
365 '''gid  50-100     700     # map 50-100 to 700-750
366 '''.fi
367 '''.TP
368 '''.IR map_nis
369 '''This option enables NIS-based uid/gid mapping. For instance, when
370 '''the server encounters the uid 123 on the server, it will obtain the
371 '''login name associated with it, and contact the NFS client's NIS server
372 '''to obtain the uid the client associates with the name.
373 '''.IP
374 '''In order to do this, the NFS server must know the client's NIS domain.
375 '''This is specified as an argument to the
376 '''.I map_nis
377 '''options, e.g.
378 '''.IP
379 '''.I map_nis=foo.com
380 '''.IP
381 '''Note that it may not be sufficient to simply specify the NIS domain
382 '''here; you may have to take additional actions before
383 '''.I nfsd
384 '''is actually able to contact the server. If your distribution uses
385 '''the NYS library, you can specify one or more NIS servers for the
386 '''client's domain in
387 '''.IR /etc/yp.conf .
388 '''If you are using a different NIS library, you may have to obtain a
389 '''special
390 '''.IR ypbind (8)
391 '''daemon that can be configured via
392 '''.IR yp.conf .
393 .TP
394 .IR anonuid " and " anongid
395 These options explicitly set the uid and gid of the anonymous account.
396 This option is primarily useful for PC/NFS clients, where you might want
397 all requests appear to be from one user. As an example, consider the
398 export entry for
399 .B /home/joe
400 in the example section below, which maps all requests to uid 150 (which
401 is supposedly that of user joe).
402 .IP
403 .SH EXAMPLE
404 .PP
405 .nf
406 .ta +3i
407 # sample /etc/exports file
408 /               master(rw) trusty(rw,no_root_squash)
409 /projects       proj*.local.domain(rw)
410 /usr            *.local.domain(ro) @trusted(rw)
411 /home/joe       pc001(rw,all_squash,anonuid=150,anongid=100)
412 /pub            (ro,insecure,all_squash)
413 '''/pub/private    (noaccess)
414 .fi
415 .PP
416 The first line exports the entire filesystem to machines master and trusty.
417 In addition to write access, all uid squashing is turned off for host
418 trusty. The second and third entry show examples for wildcard hostnames
419 and netgroups (this is the entry `@trusted'). The fourth line shows the
420 entry for the PC/NFS client discussed above. Line 5 exports the
421 public FTP directory to every host in the world, executing all requests
422 under the nobody account. The
423 .I insecure 
424 option in this entry also allows clients with NFS implementations that
425 don't use a reserved port for NFS.
426 ''' The last line denies all NFS clients
427 '''access to the private directory.
428 '''.SH CAVEATS
429 '''Unlike other NFS server implementations, this
430 '''.I nfsd
431 '''allows you to export both a directory and a subdirectory thereof to
432 '''the same host, for instance 
433 '''.IR /usr " and " /usr/X11R6 .
434 '''In this case, the mount options of the most specific entry apply. For
435 '''instance, when a user on the client host accesses a file in 
436 '''.IR /usr/X11R6 ,
437 '''the mount options given in the 
438 '''.I /usr/X11R6 
439 '''entry apply. This is also true when the latter is a wildcard or netgroup
440 '''entry.
441 .SH FILES
442 /etc/exports
443 '''.SH DIAGNOSTICS
444 '''An error parsing the file is reported using syslogd(8) as level NOTICE from
445 '''a DAEMON whenever nfsd(8) or mountd(8) is started up.  Any unknown
446 '''host is reported at that time, but often not all hosts are not yet known
447 '''to named(8) at boot time, thus as hosts are found they are reported
448 '''with the same syslogd(8) parameters.