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

EXAMPLE

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

FILES

433       /etc/exports /etc/exports.d
434

SEE ALSO

436       exportfs(8), netgroup(5), mountd(8), nfsd(8), showmount(8).
437
438
439
440                               31 December 2009                     exports(5)
Impressum