- NetBSD Manual Pages
EXPORTS(5) NetBSD File Formats Manual EXPORTS(5)
Powered by man-cgi (2020-09-24).
Maintained for NetBSD
by Kimmo Suominen.
Based on man-cgi by Panagiotis Christias.
exports -- define remote mount points for NFS mount requests
The exports file specifies remote mount points for the NFS mount protocol
per the NFS server specification; see Network File System Protocol
Specification RFC 1094, Appendix A and NFS: Network File System Version 3
Specification, Appendix I.
Each line in the file (other than comment lines that begin with a `#')
specifies the mount point(s) and export flags within one local server
filesystem for one or more hosts. A host may be specified only once for
each local filesystem on the server and there may be only one default
entry for each server filesystem that applies to all other hosts. The
latter exports the filesystem to the ``world'' and should be used only
when the filesystem contains public information.
If you have modified the /etc/exports file, send the mountd a SIGHUP to
make it re-read the /etc/exports file: ``kill -HUP `cat
In a mount entry, the first field(s) specify the directory path(s) within
a server filesystem that can be mounted on by the corresponding
client(s). There are two forms of this specification. The first is to
list all mount points as absolute directory paths separated by white-
space. The second is to specify the pathname of the root of the filesys-
tem followed by the -alldirs flag; this form allows the host(s) to mount
at any point within the filesystem, including regular files. Note that
the -alldirs option should not be used as a security measure to make
clients mount only those subdirectories that they should have access to.
A client can still access the whole filesystem via individual RPCs if it
wanted to, even if just one subdirectory has been mounted. The pathnames
must not have any symbolic links in them and should not have any ``.'' or
``..'' components. Mount points for a filesystem may appear on multiple
lines each with different sets of hosts and export options.
The second component of a line specifies how the filesystem is to be
exported to the host set. The option flags specify whether the filesys-
tem is exported read-only or read-write and how the client uid is mapped
to user credentials on the server.
Export options are specified as follows:
-maproot=user The credential of the specified user is used for remote
access by root. The credential includes all the groups to which the user
is a member on the local machine (see id(1)). The user may be specified
by name or number.
-maproot=user:group1:group2:... The colon separated list is used to spec-
ify the precise credential to be used for remote access by root. The
elements of the list may be either names or numbers. Note that user:
should be used to distinguish a credential containing no groups from a
complete credential for that user.
-mapall=user or -mapall=user:group1:group2:... specifies a mapping for
all client uids (including root) using the same semantics as -maproot.
The option -r is a synonym for -maproot in an effort to be backward com-
patible with older export file formats.
In the absence of -maproot and -mapall options, remote accesses by root
will result in using a credential of -2:-2. All other users will be
mapped to their remote credential. If a -maproot option is given, remote
access by root will be mapped to that credential instead of -2:-2. If a
-mapall option is given, all users (including root) will be mapped to
that credential in place of their own.
The -kerb option specifies that the Kerberos authentication server should
be used to authenticate and map client credentials. This option is cur-
rently not implemented.
The -ro option specifies that the filesystem should be exported read-only
(default read/write). The option -o is a synonym for -ro in an effort to
be backward compatible with older export file formats.
The -noresvport option specifies that NFS RPC calls for the filesystem do
not have to come from reserved ports. Normally, clients are required to
use reserved ports for operations. Using this option decreases the secu-
rity of your system.
The -noresvmnt option specifies that mount RPC requests for the filesys-
tem do not have to come from reserved ports. Normally, clients are
required to use reserved ports for mount requests. Using this option
decreases the security of your system.
WebNFS exports strictly according to the spec (RFC 2054 and RFC 2055) can
be done with the -public flag. However, this flag in itself allows r/w
access to all files in the filesystem, not requiring reserved ports and
not remapping uids. It is only provided to conform to the spec, and
should normally not be used. For a WebNFS export, use the -webnfs flag,
which implies -public, -mapall=nobody and -ro.
A -index=file option can be used to specify a file whose handle will be
returned if a directory is looked up using the public filehandle (Web-
NFS). This is to mimic the behavior of URLs. If no -index option is
specified, a directory filehandle will be returned as usual. The -index
option only makes sense in combination with the -public or -webnfs flags.
Warning: exporting a filesystem both using WebNFS and read/write in the
normal way to other hosts should be avoided in an environment that is
vulnerable to IP spoofing. WebNFS enables any client to get filehandles
to the exported filesystem. Using IP spoofing, a client could then pre-
tend to be a host to which the same filesystem was exported read/write,
and use the handle to gain access to that filesystem.
The third component of a line specifies the host set to which the line
applies. If no host set is specified, the filesystem is exported to
everyone. The set may be specified in three ways. The first way is to
list the host name(s) separated by white space. (Standard internet
``dot'' addresses may be used in place of names.) The second way is to
specify a ``netgroup'' as defined in the netgroup file (see netgroup(5)).
A netgroup that contains an item that does have a host entry is treated
like an error. The third way is to specify an internet subnetwork using
a network and network mask that is defined as the set of all hosts with
addresses within the subnetwork. This latter approach requires less
overhead within the kernel and is recommended for cases where the export
line refers to a large number of clients within an administrative subnet.
The first two cases are specified by simply listing the name(s) separated
by whitespace. All names are checked to see if they are ``netgroup''
names first and are assumed to be hostnames otherwise. Using the full
domain specification for a hostname can normally circumvent the problem
of a host that has the same name as a netgroup. The third case is speci-
fied by the flag -network=netname[/prefixlength] and optionally
-mask=netmask. The netmask may be specified either by attaching a
prefixlength to the -network option, or by using a separate -mask option.
If the mask is not specified, it will default to the mask for that net-
work class (A, B or C; see inet(4)).
Scoped IPv6 address must carry scope identifier as documented in
inet6(4). For example, ``fe80::%ne2/10'' is used to specify fe80::/10 on
/usr /usr/local -maproot=0:10 friends
/usr -maproot=daemon grumpy.cis.uoguelph.ca 18.104.22.168
/usr -ro -mapall=nobody
/u -maproot=bin: -network 131.104.48 -mask 255.255.255.0
/a -network 192.168.0/24
/a -network 3ffe:1ce1:1:fe80::/64
/u2 -maproot=root friends
/u2 -alldirs -kerb -network cis-net -mask cis-mask
Given that /usr, /u, and /u2 are local filesystem mount points, the above
example specifies the following: /usr is exported to hosts friends where
friends is specified in the netgroup file with users mapped to their
remote credentials and root mapped to uid 0 and group 10. It is exported
read-write and the hosts in ``friends'' can mount either /usr or
/usr/local. It is exported to 22.214.171.124 and grumpy.cis.uoguelph.ca
with users mapped to their remote credentials and root mapped to the user
and groups associated with ``daemon''; it is exported to the rest of the
world as read-only with all users mapped to the user and groups associ-
ated with ``nobody''.
/u is exported to all hosts on the subnetwork 131.104.48 with root mapped
to the uid for ``bin'' and with no group access.
/u2 is exported to the hosts in ``friends'' with root mapped to uid and
groups associated with ``root''; it is exported to all hosts on network
``cis-net'' allowing mounts at any directory within /u2 and mapping all
uids to credentials for the principal that is authenticated by a Kerberos
/a is exported to the network 192.168.0.0, with a netmask of
255.255.255.0. However, the netmask length in the entry for /a is not
specified through a -mask option, but through the /prefix notation.
/a is also exported to the IPv6 network 3ffe:1ce1:1:fe80:: address, using
the upper 64 bits as the prefix. Note that, unlike with IPv4 network
addresses, the specified network address must be complete, and not just
contain the upper bits. With IPv6 addresses, the -mask option must not
/etc/exports The default remote mount-point file.
netgroup(5), mountd(8), nfsd(8), showmount(8)
Don't re-export NFS-mounted filesystems unless you are sure of the impli-
cations. NFS has some assumptions about the characteristics of the file
systems being exported, e.g. when timestamps are updated. Re-exporting
should work to some extent and can even be useful in some cases, but
don't expect it works as well as with local file systems.
The export options are tied to the local mount points in the kernel and
must be non-contradictory for any exported subdirectory of the local
server mount point. It is recommended that all exported directories
within the same server filesystem be specified on adjacent lines going
down the tree. You cannot specify a hostname that is also the name of a
netgroup. Specifying the full domain specification for a hostname can
normally circumvent the problem.
NetBSD 9.1 October 8, 2006 NetBSD 9.1