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

EXAMPLE

363       # sample /etc/exports file
364       /               master(rw) trusty(rw,no_root_squash)
365       /projects       proj*.local.domain(rw)
366       /usr            *.local.domain(ro) @trusted(rw)
367       /home/joe       pc001(rw,all_squash,anonuid=150,anongid=100)
368       /pub            *(ro,insecure,all_squash)
369       /srv/www        -sync,rw server @trusted @external(ro)
370       /foo            2001:db8:9:e54::/64(rw) 192.0.2.0/24(rw)
371       /build          buildhost[0-9].local.domain(rw)
372
373       The  first  line  exports  the entire filesystem to machines master and
374       trusty.  In addition to write access, all uid squashing is  turned  off
375       for  host trusty. The second and third entry show examples for wildcard
376       hostnames and netgroups (this is the entry `@trusted'). The fourth line
377       shows  the  entry for the PC/NFS client discussed above. Line 5 exports
378       the public FTP directory to every host  in  the  world,  executing  all
379       requests  under  the  nobody account. The insecure option in this entry
380       also allows clients with NFS implementations that don't use a  reserved
381       port  for  NFS.   The  sixth line exports a directory read-write to the
382       machine 'server' as well as the `@trusted' netgroup, and  read-only  to
383       netgroup  `@external', all three mounts with the `sync' option enabled.
384       The seventh line exports a directory to both an IPv6 and an  IPv4  sub‐
385       net. The eighth line demonstrates a character class wildcard match.
386

FILES

388       /etc/exports /etc/exports.d
389

SEE ALSO

391       exportfs(8), netgroup(5), mountd(8), nfsd(8), showmount(8).
392
393
394
395                               31 December 2009                     exports(5)
Impressum