1EXPORTS(5)                 Linux File Formats Manual                EXPORTS(5)
2
3
4

NAME

6       exports - NFS file systems being exported (for Kernel based NFS)
7

SYNOPSIS

9       /etc/exports
10

DESCRIPTION

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

EXAMPLE

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

FILES

356       /etc/exports
357

SEE ALSO

359       exportfs(8), netgroup(5), mountd(8), nfsd(8), showmount(8).
360
361
362
363Linux                            4 March 2005                       EXPORTS(5)
Impressum