1exports(5)                    File Formats Manual                   exports(5)
2
3
4

NAME

6       exports - NFS server export table
7

DESCRIPTION

9       The  file  /etc/exports contains a table of local physical file systems
10       on an NFS server that are accessible to NFS clients.  The  contents  of
11       the file are maintained by the server's system administrator.
12
13       Each file system in this table has a list of options and an access con‐
14       trol list.  The table is used by exportfs(8)  to  give  information  to
15       mountd(8).
16
17       The  file  format  is similar to the SunOS exports file. Each line con‐
18       tains an export  point  and  a  whitespace-separated  list  of  clients
19       allowed  to mount the file system at that point. Each listed client may
20       be immediately followed by a  parenthesized,  comma-separated  list  of
21       export  options  for  that client. No whitespace is permitted between a
22       client and its option list.
23
24       Also, each line may have one or more specifications for default options
25       after  the path name, in the form of a dash ("-") followed by an option
26       list. The option list is used for all subsequent exports on  that  line
27       only.
28
29       Blank  lines  are  ignored.  A pound sign ("#") introduces a comment to
30       the end of the line. Entries may be continued across newlines  using  a
31       backslash.  If an export name contains spaces it should be quoted using
32       double quotes. You can also specify spaces or other  unusual  character
33       in  the export name using a backslash followed by the character code as
34       three octal digits.
35
36       To apply changes to this file, run exportfs  -ra  or  restart  the  NFS
37       server.
38
39   Machine Name Formats
40       NFS clients may be specified in a number of ways:
41
42       single host
43              You  may specify a host either by an abbreviated name recognized
44              be the resolver,  the  fully  qualified  domain  name,  an  IPv4
45              address,  or  an IPv6 address. IPv6 addresses must not be inside
46              square brackets in /etc/exports lest they be confused with char‐
47              acter-class wildcard matches.
48
49       IP networks
50              You  can  also  export  directories to all hosts on an IP (sub-)
51              network simultaneously. This is done by specifying an IP address
52              and  netmask  pair  as  address/netmask where the netmask can be
53              specified in dotted-decimal format,  or  as  a  contiguous  mask
54              length.   For example, either `/255.255.252.0' or `/22' appended
55              to the network base IPv4 address results  in  identical  subnet‐
56              works with 10 bits of host. IPv6 addresses must use a contiguous
57              mask length and must not be inside square brackets to avoid con‐
58              fusion  with character-class wildcards. Wildcard characters gen‐
59              erally do not work on IP addresses,  though  they  may  work  by
60              accident when reverse DNS lookups fail.
61
62       wildcards
63              Machine  names  may  contain the wildcard characters * and ?, or
64              may contain character  class  lists  within  [square  brackets].
65              This  can  be  used  to  make the exports file more compact; for
66              instance,  *.cs.foo.edu  matches  all  hosts   in   the   domain
67              cs.foo.edu.  As these characters also match the dots in a domain
68              name, the given pattern will also match  all  hosts  within  any
69              subdomain of cs.foo.edu.
70
71       netgroups
72              NIS  netgroups  may  be  given as @group.  Only the host part of
73              each netgroup members is consider in  checking  for  membership.
74              Empty  host  parts  or  those  containing  a single dash (-) are
75              ignored.
76
77       anonymous
78              This is specified by a single * character (not  to  be  confused
79              with the wildcard entry above) and will match all clients.
80
81       If a client matches more than one of the specifications above, then the
82       first match from the above list order takes precedence - regardless  of
83       the  order they appear on the export line. However, if a client matches
84       more than one of the same type of specification (e.g.  two  netgroups),
85       then  the  first  match  from  the order they appear on the export line
86       takes precedence.
87
88   RPCSEC_GSS security
89       You may use the special strings "gss/krb5", "gss/krb5i", or "gss/krb5p"
90       to restrict access to clients using rpcsec_gss security.  However, this
91       syntax is deprecated; on linux kernels since 2.6.23, you should instead
92       use the "sec=" export option:
93
94       sec=   The  sec= option, followed by a colon-delimited list of security
95              flavors, restricts the export to clients  using  those  flavors.
96              Available  security flavors include sys (the default--no crypto‐
97              graphic security), krb5 (authentication only), krb5i  (integrity
98              protection),  and  krb5p (privacy protection).  For the purposes
99              of security flavor negotiation, order counts: preferred  flavors
100              should  be  listed  first.   The  order  of the sec= option with
101              respect to the other options does not matter,  unless  you  want
102              some options to be enforced differently depending on flavor.  In
103              that case you may include multiple sec= options,  and  following
104              options will be enforced only for access using flavors listed in
105              the immediately preceding sec= option.  The  only  options  that
106              are  permitted  to  vary in this way are ro, rw, no_root_squash,
107              root_squash, and all_squash.
108
109   General Options
110       exportfs understands the following export options:
111
112       secure This option requires that requests not using gss originate on an
113              Internet  port  less than IPPORT_RESERVED (1024). This option is
114              on by default.  To turn it off, specify insecure.  (NOTE:  older
115              kernels  (before  upstream  kernel  version  4.17) enforced this
116              requirement on gss requests as well.)
117
118       rw     Allow both read and write  requests  on  this  NFS  volume.  The
119              default is to disallow any request which changes the filesystem.
120              This can also be made explicit by using the ro option.
121
122       async  This option allows the NFS server to violate  the  NFS  protocol
123              and  reply  to  requests before any changes made by that request
124              have been committed to stable storage (e.g. disc drive).
125
126              Using this option usually improves performance, but at the  cost
127              that  an unclean server restart (i.e. a crash) can cause data to
128              be lost or corrupted.
129
130
131       sync   Reply to requests only after the changes have been committed  to
132              stable storage (see async above).
133
134              In  releases  of  nfs-utils up to and including 1.0.0, the async
135              option was the default.  In all releases after  1.0.0,  sync  is
136              the  default,  and async must be explicitly requested if needed.
137              To  help  make  system  administrators  aware  of  this  change,
138              exportfs will issue a warning if neither sync nor async is spec‐
139              ified.
140
141       no_wdelay
142              This option has no effect if async is also set.  The NFS  server
143              will  normally delay committing a write request to disc slightly
144              if it suspects that another related  write  request  may  be  in
145              progress  or  may  arrive  soon.   This  allows  multiple  write
146              requests to be committed to disc with the  one  operation  which
147              can improve performance.  If an NFS server received mainly small
148              unrelated requests, this behaviour could actually reduce perfor‐
149              mance,  so  no_wdelay  is available to turn it off.  The default
150              can be explicitly requested with the wdelay option.
151
152       nohide This option is based on the option of the same name provided  in
153              IRIX  NFS.  Normally, if a server exports two filesystems one of
154              which is mounted on the other, then  the  client  will  have  to
155              mount  both filesystems explicitly to get access to them.  If it
156              just mounts the parent, it will see an empty  directory  at  the
157              place where the other filesystem is mounted.  That filesystem is
158              "hidden".
159
160              Setting the nohide option on a filesystem causes it  not  to  be
161              hidden,  and  an appropriately authorised client will be able to
162              move from the parent to that  filesystem  without  noticing  the
163              change.
164
165              However,  some  NFS clients do not cope well with this situation
166              as, for instance, it is then possible for two files in  the  one
167              apparent filesystem to have the same inode number.
168
169              The  nohide  option  is  currently only effective on single host
170              exports.  It does not work reliably with  netgroup,  subnet,  or
171              wildcard exports.
172
173              This option can be very useful in some situations, but it should
174              be used with due care, and only after confirming that the client
175              system copes with the situation effectively.
176
177              The  option  can be explicitly disabled for NFSv2 and NFSv3 with
178              hide.
179
180              This option is not relevant when  NFSv4  is  use.   NFSv4  never
181              hides  subordinate filesystems.  Any filesystem that is exported
182              will be visible where expected when using NFSv4.
183
184       crossmnt
185              This option is similar to nohide but it makes  it  possible  for
186              clients to access all filesystems mounted on a filesystem marked
187              with crossmnt.  Thus when a child filesystem "B" is mounted on a
188              parent "A", setting crossmnt on "A" has a similar effect to set‐
189              ting "nohide" on B.
190
191              With  nohide  the  child  filesystem  needs  to  be   explicitly
192              exported.   With crossmnt it need not.  If a child of a crossmnt
193              file is not explicitly exported,  then  it  will  be  implicitly
194              exported  with the same export options as the parent, except for
195              fsid=.  This makes it impossible to not  export  a  child  of  a
196              crossmnt  filesystem.   If some but not all subordinate filesys‐
197              tems of a parent are to be exported, then they must  be  explic‐
198              itly exported and the parent should not have crossmnt set.
199
200              The  nocrossmnt  option can explictly disable crossmnt if it was
201              previously set.  This is rarely useful.
202
203       no_subtree_check
204              This option disables subtree checking, which has  mild  security
205              implications, but can improve reliability in some circumstances.
206
207              If  a  subdirectory  of  a filesystem is exported, but the whole
208              filesystem isn't then whenever a NFS request arrives, the server
209              must check not only that the accessed file is in the appropriate
210              filesystem (which is easy) but also that it is in  the  exported
211              tree (which is harder). This check is called the subtree_check.
212
213              In  order  to  perform  this check, the server must include some
214              information about the location of the file in  the  "filehandle"
215              that  is  given  to  the  client.   This can cause problems with
216              accessing files that are renamed while a client  has  them  open
217              (though in many simple cases it will still work).
218
219              subtree  checking  is  also  used to make sure that files inside
220              directories to which only root has access can only  be  accessed
221              if  the  filesystem is exported with no_root_squash (see below),
222              even if the file itself allows more general access.
223
224              As a general guide, a home directory filesystem, which  is  nor‐
225              mally  exported  at  the  root and may see lots of file renames,
226              should be exported with subtree checking disabled.  A filesystem
227              which  is  mostly  readonly,  and at least doesn't see many file
228              renames (e.g. /usr or /var) and for which subdirectories may  be
229              exported,  should  probably  be  exported  with  subtree  checks
230              enabled.
231
232              The default of having subtree checks enabled, can be  explicitly
233              requested with subtree_check.
234
235              From  release  1.1.0  of  nfs-utils onwards, the default will be
236              no_subtree_check as subtree_checking tends to cause  more  prob‐
237              lems  than it is worth.  If you genuinely require subtree check‐
238              ing, you should explicitly put that option in the exports  file.
239              If  you  put  neither  option,  exportfs  will warn you that the
240              change is pending.
241
242
243       insecure_locks
244
245       no_auth_nlm
246              This option (the two names are synonymous) tells the NFS  server
247              not to require authentication of locking requests (i.e. requests
248              which use the NLM  protocol).   Normally  the  NFS  server  will
249              require  a  lock request to hold a credential for a user who has
250              read access to the file.  With this flag no access  checks  will
251              be performed.
252
253              Early  NFS  client implementations did not send credentials with
254              lock requests, and many current NFS clients  still  exist  which
255              are based on the old implementations.  Use this flag if you find
256              that you can only lock files which are world readable.
257
258              The  default  behaviour  of  requiring  authentication  for  NLM
259              requests  can be explicitly requested with either of the synony‐
260              mous auth_nlm, or secure_locks.
261
262
263       mountpoint=path
264
265       mp     This option makes it possible to only export a directory  if  it
266              has  successfully  been  mounted.   If  no  path  is given (e.g.
267              mountpoint or mp) then the export point must  also  be  a  mount
268              point.  If it isn't then the export point is not exported.  This
269              allows you to be sure that the directory underneath a mountpoint
270              will never be exported by accident if, for example, the filesys‐
271              tem failed to mount due to a disc error.
272
273              If a path is given (e.g.  mountpoint=/path or mp=/path) then the
274              nominated  path  must  be a mountpoint for the exportpoint to be
275              exported.
276
277
278       fsid=num|root|uuid
279              NFS needs to  be  able  to  identify  each  filesystem  that  it
280              exports.  Normally it will use a UUID for the filesystem (if the
281              filesystem has such a thing) or the device number of the  device
282              holding  the  filesystem  (if  the  filesystem  is stored on the
283              device).
284
285              As not all filesystems  are  stored  on  devices,  and  not  all
286              filesystems  have UUIDs, it is sometimes necessary to explicitly
287              tell NFS how to identify a filesystem.  This is  done  with  the
288              fsid= option.
289
290              For NFSv4, there is a distinguished filesystem which is the root
291              of all exported filesystem.  This is specified with fsid=root or
292              fsid=0 both of which mean exactly the same thing.
293
294              Other  filesystems  can be identified with a small integer, or a
295              UUID which should contain 32 hex digits and  arbitrary  punctua‐
296              tion.
297
298              Linux  kernels  version 2.6.20 and earlier do not understand the
299              UUID setting so a small integer must be used if an  fsid  option
300              needs  to  be set for such kernels.  Setting both a small number
301              and a UUID is supported so the same configuration can be made to
302              work on old and new kernels alike.
303
304
305       nordirplus
306              This  option  will  disable  READDIRPLUS request handling.  When
307              set, READDIRPLUS requests from NFS clients  return  NFS3ERR_NOT‐
308              SUPP,  and  clients  fall  back on READDIR.  This option affects
309              only NFSv3 clients.
310
311       refer=path@host[+host][:path@host[+host]]
312              A client referencing the export point will be directed to choose
313              from  the given list an alternative location for the filesystem.
314              (Note that the server must have a mountpoint here, though a dif‐
315              ferent filesystem is not required; so, for example, mount --bind
316              /path /path is sufficient.)
317
318       replicas=path@host[+host][:path@host[+host]]
319              If the client asks for  alternative  locations  for  the  export
320              point,  it  will  be given this list of alternatives. (Note that
321              actual replication of the filesystem must be handled elsewhere.)
322
323
324       pnfs   This option enables the use of the pNFS extension if the  proto‐
325              col level is NFSv4.1 or higher, and the filesystem supports pNFS
326              exports.  With pNFS clients can bypass the  server  and  perform
327              I/O  directly  to storage devices. The default can be explicitly
328              requested with the no_pnfs option.
329
330
331       security_label
332              With this option set, clients using NFSv4.2 or  higher  will  be
333              able  to set and retrieve security labels (such as those used by
334              SELinux).  This will only work if all clients use  a  consistent
335              security  policy.   Note that early kernels did not support this
336              export option, and instead enabled security labels by default.
337
338
339   User ID Mapping
340       nfsd bases its access control to files on the server machine on the uid
341       and  gid  provided  in each NFS RPC request. The normal behavior a user
342       would expect is that she can access her files on the server just as she
343       would  on  a  normal  file system. This requires that the same uids and
344       gids are used on the client and the server machine. This is not  always
345       true, nor is it always desirable.
346
347       Very  often, it is not desirable that the root user on a client machine
348       is also treated as root when accessing files on the NFS server. To this
349       end,  uid  0 is normally mapped to a different id: the so-called anony‐
350       mous or nobody uid. This mode of operation (called `root squashing') is
351       the default, and can be turned off with no_root_squash.
352
353       By  default,  exportfs  chooses  a  uid  and  gid of 65534 for squashed
354       access. These values can also be overridden by the anonuid and  anongid
355       options.   Finally,  you can map all user requests to the anonymous uid
356       by specifying the all_squash option.
357
358       Here's the complete list of mapping options:
359
360       root_squash
361              Map requests from uid/gid 0 to the anonymous uid/gid. Note  that
362              this  does  not  apply  to  any other uids or gids that might be
363              equally sensitive, such as user bin or group staff.
364
365       no_root_squash
366              Turn off root squashing. This option is mainly useful for  disk‐
367              less clients.
368
369       all_squash
370              Map  all  uids  and  gids to the anonymous user. Useful for NFS-
371              exported public FTP directories, news  spool  directories,  etc.
372              The  opposite option is no_all_squash, which is the default set‐
373              ting.
374
375       anonuid and anongid
376              These options explicitly set the uid and gid  of  the  anonymous
377              account.   This  option  is primarily useful for PC/NFS clients,
378              where you might want all requests appear to be from one user. As
379              an example, consider the export entry for /home/joe in the exam‐
380              ple section below, which maps all requests to uid 150 (which  is
381              supposedly that of user joe).
382
383   Extra Export Tables
384       After  reading  /etc/exports exportfs reads files in the /etc/exports.d
385       directory as extra export tables.  Only files ending  in  .exports  are
386       considered.   Files  beginning  with a dot are ignored.  The format for
387       extra export tables is the same as /etc/exports
388

EXAMPLE

390       # sample /etc/exports file
391       /               master(rw) trusty(rw,no_root_squash)
392       /projects       proj*.local.domain(rw)
393       /usr            *.local.domain(ro) @trusted(rw)
394       /home/joe       pc001(rw,all_squash,anonuid=150,anongid=100)
395       /pub            *(ro,insecure,all_squash)
396       /srv/www        -sync,rw server @trusted @external(ro)
397       /foo            2001:db8:9:e54::/64(rw) 192.0.2.0/24(rw)
398       /build          buildhost[0-9].local.domain(rw)
399
400       The first line exports the entire filesystem  to  machines  master  and
401       trusty.   In  addition to write access, all uid squashing is turned off
402       for host trusty. The second and third entry show examples for  wildcard
403       hostnames and netgroups (this is the entry `@trusted'). The fourth line
404       shows the entry for the PC/NFS client discussed above. Line  5  exports
405       the  public  FTP  directory  to  every host in the world, executing all
406       requests under the nobody account. The insecure option  in  this  entry
407       also  allows clients with NFS implementations that don't use a reserved
408       port for NFS.  The sixth line exports a  directory  read-write  to  the
409       machine  'server'  as well as the `@trusted' netgroup, and read-only to
410       netgroup `@external', all three mounts with the `sync' option  enabled.
411       The  seventh  line exports a directory to both an IPv6 and an IPv4 sub‐
412       net. The eighth line demonstrates a character class wildcard match.
413

FILES

415       /etc/exports /etc/exports.d
416

SEE ALSO

418       exportfs(8), netgroup(5), mountd(8), nfsd(8), showmount(8).
419
420
421
422                               31 December 2009                     exports(5)
Impressum