]> git.decadent.org.uk Git - nfs-utils.git/blob - utils/exportfs/exports.man
Imported upstream 1.2.6
[nfs-utils.git] / utils / exportfs / exports.man
1 .\"@(#)exports.5"
2 .\"
3 .TH exports 5 "31 December 2009"
4 .SH NAME
5 exports \- NFS server export table
6 .SH DESCRIPTION
7 The file
8 .I /etc/exports
9 contains a table of local physical file systems on an NFS server
10 that are accessible to NFS clients.
11 The contents of the file are maintained by the server's system
12 administrator.
13 .PP
14 Each file system in this table has a list of options and an
15 access control list.
16 The table is used by
17 .BR exportfs (8)
18 to give information to
19 .BR mountd (8).
20 .PP
21 The file format is similar to the SunOS
22 .I exports
23 file. Each line contains an export point and a whitespace-separated list
24 of clients allowed to mount the file system at that point. Each listed
25 client may be immediately followed by a parenthesized, comma-separated
26 list of export options for that client. No whitespace is permitted
27 between a client and its option list.
28 .PP
29 Also, each line may have one or more specifications for default options
30 after the path name, in the form of a dash ("\-") followed by an option
31 list. The option list is used for all subsequent exports on that line
32 only.
33 .PP
34 Blank lines are ignored.  A pound sign ("#") introduces a comment to the
35 end of the line. Entries may be continued across newlines using a
36 backslash. If an export name contains spaces it should be quoted using
37 double quotes. You can also specify spaces or other unusual character in
38 the export name using a backslash followed by the character code as three
39 octal digits.
40 .PP
41 To apply changes to this file, run
42 .BR exportfs \-ra
43 or restart the NFS server.
44 .PP
45 .SS Machine Name Formats
46 NFS clients may be specified in a number of ways:
47 .IP "single host
48 You may specify a host either by an
49 abbreviated name recognized be the resolver, the fully qualified domain
50 name, an IPv4 address, or an IPv6 address. IPv6 addresses must not be
51 inside square brackets in /etc/exports lest they be confused with
52 character-class wildcard matches.
53 .IP "IP networks
54 You can also export directories to all hosts on an IP (sub-) network
55 simultaneously. This is done by specifying an IP address and netmask pair
56 as
57 .IR address/netmask
58 where the netmask can be specified in dotted-decimal format, or as a
59 contiguous mask length.
60 For example, either `/255.255.252.0' or `/22' appended
61 to the network base IPv4 address results in identical subnetworks with 10 bits
62 of host. IPv6 addresses must use a contiguous mask length and must not be inside square brackets to avoid confusion with character-class wildcards. Wildcard characters generally do not work on IP addresses, though they
63 may work by accident when reverse DNS lookups fail.
64 .IP "wildcards
65 Machine names may contain the wildcard characters \fI*\fR and \fI?\fR, or may contain character class lists within [square brackets].
66 This can be used to make the \fIexports\fR file more compact; for instance,
67 \fI*.cs.foo.edu\fR matches all hosts in the domain
68 \fIcs.foo.edu\fR.  As these characters also match the dots in a domain
69 name, the given pattern will also match all hosts within any subdomain
70 of \fIcs.foo.edu\fR.
71 .IP "netgroups
72 NIS netgroups may be given as
73 .IR @group .
74 Only the host part of each
75 netgroup members is consider in checking for membership.  Empty host
76 parts or those containing a single dash (\-) are ignored.
77 .IP "anonymous
78 This is specified by a single
79 .I *
80 character (not to be confused with the
81 .I wildcard
82 entry above) and will match all clients.
83 .\".TP
84 .\".B =public
85 .\"This is a special ``hostname'' that identifies the given directory name
86 .\"as the public root directory (see the section on WebNFS in
87 .\".BR nfsd (8)
88 .\"for a discussion of WebNFS and the public root handle). When using this
89 .\"convention,
90 .\".B =public
91 .\"must be the only entry on this line, and must have no export options
92 .\"associated with it. Note that this does
93 .\".I not
94 .\"actually export the named directory; you still have to set the exports
95 .\"options in a separate entry.
96 .\".PP
97 .\"The public root path can also be specified by invoking
98 .\".I nfsd
99 .\"with the
100 .\".B \-\-public\-root
101 .\"option. Multiple specifications of a public root will be ignored.
102 .PP
103 If a client matches more than one of the specifications above, then
104 the first match from the above list order takes precedence - regardless of
105 the order they appear on the export line. However, if a client matches
106 more than one of the same type of specification (e.g. two netgroups),
107 then the first match from the order they appear on the export line takes
108 precedence.
109 .SS RPCSEC_GSS security
110 You may use the special strings "gss/krb5", "gss/krb5i", or "gss/krb5p"
111 to restrict access to clients using rpcsec_gss security.  However, this
112 syntax is deprecated; on linux kernels since 2.6.23, you should instead
113 use the "sec=" export option:
114 .TP
115 .IR sec=
116 The sec= option, followed by a colon-delimited list of security flavors,
117 restricts the export to clients using those flavors.  Available security
118 flavors include sys (the default--no cryptographic security), krb5
119 (authentication only), krb5i (integrity protection), and krb5p (privacy
120 protection).  For the purposes of security flavor negotiation, order
121 counts: preferred flavors should be listed first.  The order of the sec=
122 option with respect to the other options does not matter, unless you
123 want some options to be enforced differently depending on flavor.
124 In that case you may include multiple sec= options, and following options
125 will be enforced only for access using flavors listed in the immediately
126 preceding sec= option.  The only options that are permitted to vary in
127 this way are ro, rw, no_root_squash, root_squash, and all_squash.
128 .PP
129 .SS General Options
130 .BR exportfs
131 understands the following export options:
132 .TP
133 .IR secure
134 This option requires that requests originate on an Internet port less
135 than IPPORT_RESERVED (1024). This option is on by default. To turn it
136 off, specify
137 .IR insecure .
138 .TP
139 .IR rw
140 Allow both read and write requests on this NFS volume. The
141 default is to disallow any request which changes the filesystem.
142 This can also be made explicit by using
143 the
144 .IR ro " option.
145 .TP
146 .IR async
147 This option allows the NFS server to violate the NFS protocol and
148 reply to requests before any changes made by that request have been
149 committed to stable storage (e.g. disc drive).
150
151 Using this option usually improves performance, but at the cost that
152 an unclean server restart (i.e. a crash) can cause data to be lost or
153 corrupted.
154
155 .TP
156 .IR sync
157 Reply to requests only after the changes have been committed to stable
158 storage (see
159 .IR async
160 above).
161
162 In releases of nfs-utils up to and including 1.0.0, the
163 .I async 
164 option was the
165 default.  In all releases after 1.0.0,
166 .I sync
167 is the default, and
168 .I async
169 must be explicitly requested if needed.
170 To help make system administrators aware of this change,
171 .B exportfs
172 will issue a warning if neither
173 .I sync
174 nor
175 .I async
176 is specified.
177 .TP
178 .IR no_wdelay
179 This option has no effect if
180 .I async
181 is also set.  The NFS server will normally delay committing a write request
182 to disc slightly if it suspects that another related write request may be in
183 progress or may arrive soon.  This allows multiple write requests to
184 be committed to disc with the one operation which can improve
185 performance.  If an NFS server received mainly small unrelated
186 requests, this behaviour could actually reduce performance, so
187 .IR no_wdelay
188 is available to turn it off.
189 The default can be explicitly requested with the
190 .IR wdelay " option.
191 .TP
192 .IR nohide
193 This option is based on the option of the same name provided in IRIX
194 NFS.  Normally, if a server exports two filesystems one of which is
195 mounted on the other, then the client will have to mount both
196 filesystems explicitly to get access to them.  If it just mounts the
197 parent, it will see an empty directory at the place where the other
198 filesystem is mounted.  That filesystem is "hidden".
199
200 Setting the
201 .I nohide
202 option on a filesystem causes it not to be hidden, and an
203 appropriately authorised client will be able to move from the parent to
204 that filesystem without noticing the change.
205
206 However, some NFS clients do not cope well with this situation as, for
207 instance, it is then possible for two files in the one apparent
208 filesystem to have the same inode number.
209
210 The
211 .I nohide
212 option is currently only effective on
213 .I "single host
214 exports.  It does not work reliably with netgroup, subnet, or wildcard
215 exports.
216
217 This option can be very useful in some situations, but it should be
218 used with due care, and only after confirming that the client system
219 copes with the situation effectively.
220
221 The option can be explicitly disabled with
222 .IR hide .
223 .TP
224 .IR crossmnt
225 This option is similar to
226 .I nohide
227 but it makes it possible for clients to move from the filesystem marked
228 with crossmnt to exported filesystems mounted on it.  Thus when a child
229 filesystem "B" is mounted on a parent "A", setting crossmnt on "A" has
230 the same effect as setting "nohide" on B.
231 .TP
232 .IR no_subtree_check
233 This option disables subtree checking, which has mild security
234 implications, but can improve reliability in some circumstances.
235
236 If a subdirectory of a filesystem is exported, but the whole
237 filesystem isn't then whenever a NFS request arrives, the server must
238 check not only that the accessed file is in the appropriate filesystem
239 (which is easy) but also that it is in the exported tree (which is
240 harder). This check is called the
241 .IR subtree_check .
242
243 In order to perform this check, the server must include some
244 information about the location of the file in the "filehandle" that is
245 given to the client.  This can cause problems with accessing files that
246 are renamed while a client has them open (though in many simple cases
247 it will still work).
248
249 subtree checking is also used to make sure that files inside
250 directories to which only root has access can only be accessed if the
251 filesystem is exported with
252 .I no_root_squash
253 (see below), even if the file itself allows more general access.
254
255 As a general guide, a home directory filesystem, which is normally
256 exported at the root and may see lots of file renames, should be
257 exported with subtree checking disabled.  A filesystem which is mostly
258 readonly, and at least doesn't see many file renames (e.g. /usr or
259 /var) and for which subdirectories may be exported, should probably be
260 exported with subtree checks enabled.
261
262 The default of having subtree checks enabled, can be explicitly
263 requested with
264 .IR subtree_check .
265
266 From release 1.1.0 of nfs-utils onwards, the default will be
267 .I no_subtree_check
268 as subtree_checking tends to cause more problems than it is worth.
269 If you genuinely require subtree checking, you should explicitly put
270 that option in the
271 .B exports
272 file.  If you put neither option,
273 .B exportfs
274 will warn you that the change is pending.
275
276 .TP
277 .IR insecure_locks
278 .TP
279 .IR no_auth_nlm
280 This option (the two names are synonymous) tells the NFS server not to require authentication of
281 locking requests (i.e. requests which use the NLM protocol).  Normally
282 the NFS server will require a lock request to hold a credential for a
283 user who has read access to the file.  With this flag no access checks
284 will be performed.
285
286 Early NFS client implementations did not send credentials with lock
287 requests, and many current NFS clients still exist which are based on
288 the old implementations.  Use this flag if you find that you can only
289 lock files which are world readable.
290
291 The default behaviour of requiring authentication for NLM requests can
292 be explicitly requested with either of the synonymous
293 .IR auth_nlm ,
294 or
295 .IR secure_locks .
296 .\".TP
297 .\".I noaccess
298 .\"This makes everything below the directory inaccessible for the named
299 .\"client.  This is useful when you want to export a directory hierarchy to
300 .\"a client, but exclude certain subdirectories. The client's view of a
301 .\"directory flagged with noaccess is very limited; it is allowed to read
302 .\"its attributes, and lookup `.' and `..'. These are also the only entries
303 .\"returned by a readdir.
304 .\".TP
305 .\".IR link_relative
306 .\"Convert absolute symbolic links (where the link contents start with a
307 .\"slash) into relative links by prepending the necessary number of ../'s
308 .\"to get from the directory containing the link to the root on the
309 .\"server.  This has subtle, perhaps questionable, semantics when the file
310 .\"hierarchy is not mounted at its root.
311 .\".TP
312 .\".IR link_absolute
313 .\"Leave all symbolic link as they are. This is the default operation.
314
315 .TP
316 .IR mountpoint= path
317 .TP
318 .I mp
319 This option makes it possible to only export a directory if it has
320 successfully been mounted.
321 If no path is given (e.g.
322 .IR mountpoint " or " mp )
323 then the export point must also be a mount point.  If it isn't then
324 the export point is not exported.  This allows you to be sure that the
325 directory underneath a mountpoint will never be exported by accident
326 if, for example, the filesystem failed to mount due to a disc error.
327
328 If a path is given (e.g.
329 .IR mountpoint= "/path or " mp= /path)
330 then the nominated path must be a mountpoint for the exportpoint to be
331 exported.
332
333 .TP
334 .IR fsid= num|root|uuid
335 NFS needs to be able to identify each filesystem that it exports.
336 Normally it will use a UUID for the filesystem (if the filesystem has
337 such a thing) or the device number of the device holding the
338 filesystem (if the filesystem is stored on the device).
339
340 As not all filesystems are stored on devices, and not all filesystems
341 have UUIDs, it is sometimes necessary to explicitly tell NFS how to
342 identify a filesystem.  This is done with the
343 .I fsid=
344 option.
345
346 For NFSv4, there is a distinguished filesystem which is the root of
347 all exported filesystem.  This is specified with
348 .I fsid=root
349 or
350 .I fsid=0
351 both of which mean exactly the same thing.
352
353 Other filesystems can be identified with a small integer, or a UUID
354 which should contain 32 hex digits and arbitrary punctuation.
355
356 Linux kernels version 2.6.20 and earlier do not understand the UUID
357 setting so a small integer must be used if an fsid option needs to be
358 set for such kernels.  Setting both a small number and a UUID is
359 supported so the same configuration can be made to work on old and new
360 kernels alike.
361
362 .TP
363 .IR refer= path@host[+host][:path@host[+host]]
364 A client referencing the export point will be directed to choose from
365 the given list an alternative location for the filesystem.
366 (Note that the server must have a mountpoint here, though a different
367 filesystem is not required; so, for example,
368 .IR "mount --bind" " /path /path"
369 is sufficient.)
370 .TP
371 .IR replicas= path@host[+host][:path@host[+host]]
372 If the client asks for alternative locations for the export point, it
373 will be given this list of alternatives. (Note that actual replication
374 of the filesystem must be handled elsewhere.)
375
376 .SS User ID Mapping
377 .PP
378 .B nfsd
379 bases its access control to files on the server machine on the uid and
380 gid provided in each NFS RPC request. The normal behavior a user would
381 expect is that she can access her files on the server just as she would
382 on a normal file system. This requires that the same uids and gids are
383 used on the client and the server machine. This is not always true, nor
384 is it always desirable.
385 .PP
386 Very often, it is not desirable that the root user on a client machine
387 is also treated as root when accessing files on the NFS server. To this
388 end, uid 0 is normally mapped to a different id: the so-called
389 anonymous or
390 .I nobody
391 uid. This mode of operation (called `root squashing') is the default,
392 and can be turned off with
393 .IR no_root_squash .
394 .PP
395 By default,
396 .\".B nfsd
397 .\"tries to obtain the anonymous uid and gid by looking up user
398 .\".I nobody
399 .\"in the password file at startup time. If it isn't found, a uid and gid
400 .B exportfs
401 chooses a uid and gid
402 of 65534 for squashed access. These values can also be overridden by
403 the
404 .IR anonuid " and " anongid
405 options.
406 .\".PP
407 .\"In addition to this,
408 .\".B nfsd
409 .\"lets you specify arbitrary uids and gids that should be mapped to user
410 .\"nobody as well.
411 Finally, you can map all user requests to the
412 anonymous uid by specifying the
413 .IR all_squash " option.
414 .PP
415 Here's the complete list of mapping options:
416 .TP
417 .IR root_squash
418 Map requests from uid/gid 0 to the anonymous uid/gid. Note that this does
419 not apply to any other uids or gids that might be equally sensitive, such as
420 user
421 .IR bin
422 or group
423 .IR staff .
424 .TP
425 .IR no_root_squash
426 Turn off root squashing. This option is mainly useful for diskless clients.
427 .TP
428 .IR all_squash
429 Map all uids and gids to the anonymous user. Useful for NFS-exported
430 public FTP directories, news spool directories, etc. The opposite option
431 is
432 .IR no_all_squash ,
433 which is the default setting.
434 .TP
435 .IR anonuid " and " anongid
436 These options explicitly set the uid and gid of the anonymous account.
437 This option is primarily useful for PC/NFS clients, where you might want
438 all requests appear to be from one user. As an example, consider the
439 export entry for
440 .B /home/joe
441 in the example section below, which maps all requests to uid 150 (which
442 is supposedly that of user joe).
443 .SS Extra Export Tables
444 After reading 
445 .I /etc/exports 
446 .B exportfs
447 reads files under 
448 .I /etc/exports.d. 
449 directory as extra export tables.
450 .B exportfs
451 regards only a file which name is ended with 
452 .I .exports
453 and
454 not started with 
455 .I . 
456 as an extra export file. A file which name
457 is not met this condition is just ignored.
458 The format for extra export tables is the same as 
459 .I /etc/exports
460 .
461 .IP
462 .SH EXAMPLE
463 .PP
464 .nf
465 .ta +3i
466 # sample /etc/exports file
467 /               master(rw) trusty(rw,no_root_squash)
468 /projects       proj*.local.domain(rw)
469 /usr            *.local.domain(ro) @trusted(rw)
470 /home/joe       pc001(rw,all_squash,anonuid=150,anongid=100)
471 /pub            *(ro,insecure,all_squash)
472 /srv/www        \-sync,rw server @trusted @external(ro)
473 /foo            2001:db8:9:e54::/64(rw) 192.0.2.0/24(rw)
474 /build          buildhost[0-9].local.domain(rw)
475 .\"/pub/private    (noaccess)
476 .fi
477 .PP
478 The first line exports the entire filesystem to machines master and trusty.
479 In addition to write access, all uid squashing is turned off for host
480 trusty. The second and third entry show examples for wildcard hostnames
481 and netgroups (this is the entry `@trusted'). The fourth line shows the
482 entry for the PC/NFS client discussed above. Line 5 exports the
483 public FTP directory to every host in the world, executing all requests
484 under the nobody account. The
485 .I insecure
486 option in this entry also allows clients with NFS implementations that
487 don't use a reserved port for NFS.
488 The sixth line exports a directory read-write to the machine 'server'
489 as well as the `@trusted' netgroup, and read-only to netgroup `@external',
490 all three mounts with the `sync' option enabled. The seventh line exports
491 a directory to both an IPv6 and an IPv4 subnet. The eighth line demonstrates
492 a character class wildcard match.
493 .\" The last line denies all NFS clients
494 .\"access to the private directory.
495 .\".SH CAVEATS
496 .\"Unlike other NFS server implementations, this
497 .\".B nfsd
498 .\"allows you to export both a directory and a subdirectory thereof to
499 .\"the same host, for instance
500 .\".IR /usr " and " /usr/X11R6 .
501 .\"In this case, the mount options of the most specific entry apply. For
502 .\"instance, when a user on the client host accesses a file in
503 .\".IR /usr/X11R6 ,
504 .\"the mount options given in the
505 .\".I /usr/X11R6
506 .\"entry apply. This is also true when the latter is a wildcard or netgroup
507 .\"entry.
508 .SH FILES
509 /etc/exports
510 /etc/exports.d
511 .SH SEE ALSO
512 .BR exportfs (8),
513 .BR netgroup (5),
514 .BR mountd (8),
515 .BR nfsd (8),
516 .BR showmount (8).
517 .\".SH DIAGNOSTICS
518 .\"An error parsing the file is reported using syslogd(8) as level NOTICE from
519 .\"a DAEMON whenever
520 .\".BR nfsd (8)
521 .\"or
522 .\".BR mountd (8)
523 .\"is started up.  Any unknown
524 .\"host is reported at that time, but often not all hosts are not yet known
525 .\"to
526 .\".BR named (8)
527 .\"at boot time, thus as hosts are found they are reported
528 .\"with the same
529 .\".BR syslogd (8)
530 .\"parameters.