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

EXAMPLE

341       # sample /etc/exports file
342       /               master(rw) trusty(rw,no_root_squash)
343       /projects       proj*.local.domain(rw)
344       /usr            *.local.domain(ro) @trusted(rw)
345       /home/joe       pc001(rw,all_squash,anonuid=150,anongid=100)
346       /pub            *(ro,insecure,all_squash)
347       /srv/www        -sync,rw server @trusted @external(ro)
348
349       The first line exports the entire filesystem  to  machines  master  and
350       trusty.   In  addition to write access, all uid squashing is turned off
351       for host trusty. The second and third entry show examples for  wildcard
352       hostnames and netgroups (this is the entry `@trusted'). The fourth line
353       shows the entry for the PC/NFS client discussed above. Line  5  exports
354       the  public  FTP  directory  to  every host in the world, executing all
355       requests under the nobody account. The insecure option  in  this  entry
356       also  allows clients with NFS implementations that don't use a reserved
357       port for NFS.  The sixth line exports a  directory  read-write  to  the
358       machine  'server'  as well as the `@trusted' netgroup, and read-only to
359       netgroup `@external', all three mounts with the `sync' option enabled.
360

FILES

362       /etc/exports
363

SEE ALSO

365       exportfs(8), netgroup(5), mountd(8), nfsd(8), showmount(8).
366
367
368
369                               31 December 2009                     exports(5)
Impressum