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 originate on an Internet port
113              less  than IPPORT_RESERVED (1024). This option is on by default.
114              To turn it off, specify insecure.
115
116       rw     Allow both read and write  requests  on  this  NFS  volume.  The
117              default is to disallow any request which changes the filesystem.
118              This can also be made explicit by using the ro option.
119
120       async  This option allows the NFS server to violate  the  NFS  protocol
121              and  reply  to  requests before any changes made by that request
122              have been committed to stable storage (e.g. disc drive).
123
124              Using this option usually improves performance, but at the  cost
125              that  an unclean server restart (i.e. a crash) can cause data to
126              be lost or corrupted.
127
128
129       sync   Reply to requests only after the changes have been committed  to
130              stable storage (see async above).
131
132              In  releases  of  nfs-utils up to and including 1.0.0, the async
133              option was the default.  In all releases after  1.0.0,  sync  is
134              the  default,  and async must be explicitly requested if needed.
135              To  help  make  system  administrators  aware  of  this  change,
136              exportfs will issue a warning if neither sync nor async is spec‐
137              ified.
138
139       no_wdelay
140              This option has no effect if async is also set.  The NFS  server
141              will  normally delay committing a write request to disc slightly
142              if it suspects that another related  write  request  may  be  in
143              progress  or  may  arrive  soon.   This  allows  multiple  write
144              requests to be committed to disc with the  one  operation  which
145              can improve performance.  If an NFS server received mainly small
146              unrelated requests, this behaviour could actually reduce perfor‐
147              mance,  so  no_wdelay  is available to turn it off.  The default
148              can be explicitly requested with the wdelay option.
149
150       nohide This option is based on the option of the same name provided  in
151              IRIX  NFS.  Normally, if a server exports two filesystems one of
152              which is mounted on the other, then  the  client  will  have  to
153              mount  both filesystems explicitly to get access to them.  If it
154              just mounts the parent, it will see an empty  directory  at  the
155              place where the other filesystem is mounted.  That filesystem is
156              "hidden".
157
158              Setting the nohide option on a filesystem causes it  not  to  be
159              hidden,  and  an appropriately authorised client will be able to
160              move from the parent to that  filesystem  without  noticing  the
161              change.
162
163              However,  some  NFS clients do not cope well with this situation
164              as, for instance, it is then possible for two files in  the  one
165              apparent filesystem to have the same inode number.
166
167              The  nohide  option  is  currently only effective on single host
168              exports.  It does not work reliably with  netgroup,  subnet,  or
169              wildcard exports.
170
171              This option can be very useful in some situations, but it should
172              be used with due care, and only after confirming that the client
173              system copes with the situation effectively.
174
175              The  option  can be explicitly disabled for NFSv2 and NFSv3 with
176              hide.
177
178              This option is not relevant when  NFSv4  is  use.   NFSv4  never
179              hides  subordinate filesystems.  Any filesystem that is exported
180              will be visible where expected when using NFSv4.
181
182       crossmnt
183              This option is similar to nohide but it makes  it  possible  for
184              clients to access all filesystems mounted on a filesystem marked
185              with crossmnt.  Thus when a child filesystem "B" is mounted on a
186              parent "A", setting crossmnt on "A" has a similar effect to set‐
187              ting "nohide" on B.
188
189              With  nohide  the  child  filesystem  needs  to  be   explicitly
190              exported.   With crossmnt it need not.  If a child of a crossmnt
191              file is not explicitly exported,  then  it  will  be  implicitly
192              exported  with the same export options as the parent, except for
193              fsid=.  This makes it impossible to not  export  a  child  of  a
194              crossmnt  filesystem.   If some but not all subordinate filesys‐
195              tems of a parent are to be exported, then they must  be  explic‐
196              itly exported and the parent should not have crossmnt set.
197
198              The  nocrossmnt  option can explictly disable crossmnt if it was
199              previously set.  This is rarely useful.
200
201       no_subtree_check
202              This option disables subtree checking, which has  mild  security
203              implications, but can improve reliability in some circumstances.
204
205              If  a  subdirectory  of  a filesystem is exported, but the whole
206              filesystem isn't then whenever a NFS request arrives, the server
207              must check not only that the accessed file is in the appropriate
208              filesystem (which is easy) but also that it is in  the  exported
209              tree (which is harder). This check is called the subtree_check.
210
211              In  order  to  perform  this check, the server must include some
212              information about the location of the file in  the  "filehandle"
213              that  is  given  to  the  client.   This can cause problems with
214              accessing files that are renamed while a client  has  them  open
215              (though in many simple cases it will still work).
216
217              subtree  checking  is  also  used to make sure that files inside
218              directories to which only root has access can only  be  accessed
219              if  the  filesystem is exported with no_root_squash (see below),
220              even if the file itself allows more general access.
221
222              As a general guide, a home directory filesystem, which  is  nor‐
223              mally  exported  at  the  root and may see lots of file renames,
224              should be exported with subtree checking disabled.  A filesystem
225              which  is  mostly  readonly,  and at least doesn't see many file
226              renames (e.g. /usr or /var) and for which subdirectories may  be
227              exported,  should  probably  be  exported  with  subtree  checks
228              enabled.
229
230              The default of having subtree checks enabled, can be  explicitly
231              requested with subtree_check.
232
233              From  release  1.1.0  of  nfs-utils onwards, the default will be
234              no_subtree_check as subtree_checking tends to cause  more  prob‐
235              lems  than it is worth.  If you genuinely require subtree check‐
236              ing, you should explicitly put that option in the exports  file.
237              If  you  put  neither  option,  exportfs  will warn you that the
238              change is pending.
239
240
241       insecure_locks
242
243       no_auth_nlm
244              This option (the two names are synonymous) tells the NFS  server
245              not to require authentication of locking requests (i.e. requests
246              which use the NLM  protocol).   Normally  the  NFS  server  will
247              require  a  lock request to hold a credential for a user who has
248              read access to the file.  With this flag no access  checks  will
249              be performed.
250
251              Early  NFS  client implementations did not send credentials with
252              lock requests, and many current NFS clients  still  exist  which
253              are based on the old implementations.  Use this flag if you find
254              that you can only lock files which are world readable.
255
256              The  default  behaviour  of  requiring  authentication  for  NLM
257              requests  can be explicitly requested with either of the synony‐
258              mous auth_nlm, or secure_locks.
259
260
261       mountpoint=path
262
263       mp     This option makes it possible to only export a directory  if  it
264              has  successfully  been  mounted.   If  no  path  is given (e.g.
265              mountpoint or mp) then the export point must  also  be  a  mount
266              point.  If it isn't then the export point is not exported.  This
267              allows you to be sure that the directory underneath a mountpoint
268              will never be exported by accident if, for example, the filesys‐
269              tem failed to mount due to a disc error.
270
271              If a path is given (e.g.  mountpoint=/path or mp=/path) then the
272              nominated  path  must  be a mountpoint for the exportpoint to be
273              exported.
274
275
276       fsid=num|root|uuid
277              NFS needs to  be  able  to  identify  each  filesystem  that  it
278              exports.  Normally it will use a UUID for the filesystem (if the
279              filesystem has such a thing) or the device number of the  device
280              holding  the  filesystem  (if  the  filesystem  is stored on the
281              device).
282
283              As not all filesystems  are  stored  on  devices,  and  not  all
284              filesystems  have UUIDs, it is sometimes necessary to explicitly
285              tell NFS how to identify a filesystem.  This is  done  with  the
286              fsid= option.
287
288              For NFSv4, there is a distinguished filesystem which is the root
289              of all exported filesystem.  This is specified with fsid=root or
290              fsid=0 both of which mean exactly the same thing.
291
292              Other  filesystems  can be identified with a small integer, or a
293              UUID which should contain 32 hex digits and  arbitrary  punctua‐
294              tion.
295
296              Linux  kernels  version 2.6.20 and earlier do not understand the
297              UUID setting so a small integer must be used if an  fsid  option
298              needs  to  be set for such kernels.  Setting both a small number
299              and a UUID is supported so the same configuration can be made to
300              work on old and new kernels alike.
301
302
303       nordirplus
304              This  option  will  disable  READDIRPLUS request handling.  When
305              set, READDIRPLUS requests from NFS clients  return  NFS3ERR_NOT‐
306              SUPP,  and  clients  fall  back on READDIR.  This option affects
307              only NFSv3 clients.
308
309       refer=path@host[+host][:path@host[+host]]
310              A client referencing the export point will be directed to choose
311              from  the given list an alternative location for the filesystem.
312              (Note that the server must have a mountpoint here, though a dif‐
313              ferent filesystem is not required; so, for example, mount --bind
314              /path /path is sufficient.)
315
316       replicas=path@host[+host][:path@host[+host]]
317              If the client asks for  alternative  locations  for  the  export
318              point,  it  will  be given this list of alternatives. (Note that
319              actual replication of the filesystem must be handled elsewhere.)
320
321
322       pnfs   This option enables the use of the pNFS extension if the  proto‐
323              col level is NFSv4.1 or higher, and the filesystem supports pNFS
324              exports.  With pNFS clients can bypass the  server  and  perform
325              I/O  directly  to storage devices. The default can be explicitly
326              requested with the no_pnfs option.
327
328
329       security_label
330              With this option set, clients using NFSv4.2 or  higher  will  be
331              able  to set and retrieve security labels (such as those used by
332              SELinux).  This will only work if all clients use  a  consistent
333              security  policy.   Note that early kernels did not support this
334              export option, and instead enabled security labels by default.
335
336
337   User ID Mapping
338       nfsd bases its access control to files on the server machine on the uid
339       and  gid  provided  in each NFS RPC request. The normal behavior a user
340       would expect is that she can access her files on the server just as she
341       would  on  a  normal  file system. This requires that the same uids and
342       gids are used on the client and the server machine. This is not  always
343       true, nor is it always desirable.
344
345       Very  often, it is not desirable that the root user on a client machine
346       is also treated as root when accessing files on the NFS server. To this
347       end,  uid  0 is normally mapped to a different id: the so-called anony‐
348       mous or nobody uid. This mode of operation (called `root squashing') is
349       the default, and can be turned off with no_root_squash.
350
351       By  default,  exportfs  chooses  a  uid  and  gid of 65534 for squashed
352       access. These values can also be overridden by the anonuid and  anongid
353       options.   Finally,  you can map all user requests to the anonymous uid
354       by specifying the all_squash option.
355
356       Here's the complete list of mapping options:
357
358       root_squash
359              Map requests from uid/gid 0 to the anonymous uid/gid. Note  that
360              this  does  not  apply  to  any other uids or gids that might be
361              equally sensitive, such as user bin or group staff.
362
363       no_root_squash
364              Turn off root squashing. This option is mainly useful for  disk‐
365              less clients.
366
367       all_squash
368              Map  all  uids  and  gids to the anonymous user. Useful for NFS-
369              exported public FTP directories, news  spool  directories,  etc.
370              The  opposite option is no_all_squash, which is the default set‐
371              ting.
372
373       anonuid and anongid
374              These options explicitly set the uid and gid  of  the  anonymous
375              account.   This  option  is primarily useful for PC/NFS clients,
376              where you might want all requests appear to be from one user. As
377              an example, consider the export entry for /home/joe in the exam‐
378              ple section below, which maps all requests to uid 150 (which  is
379              supposedly that of user joe).
380
381   Extra Export Tables
382       After  reading  /etc/exports exportfs reads files in the /etc/exports.d
383       directory as extra export tables.  Only files ending  in  .exports  are
384       considered.   Files  beginning  with a dot are ignored.  The format for
385       extra export tables is the same as /etc/exports
386

EXAMPLE

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

FILES

413       /etc/exports /etc/exports.d
414

SEE ALSO

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