]> git.decadent.org.uk Git - nfs-utils.git/blob - utils/exportfs/exports.man
Updated to nfs-utils 0.1.1.
[nfs-utils.git] / utils / exportfs / exports.man
1 .TH EXPORTS 5 "11 August 1997"
2 .UC 5
3 .SH NAME
4 exports \- NFS file systems being exported
5 .SH SYNOPSIS
6 .B /etc/exports
7 .SH DESCRIPTION
8 The file
9 .I /etc/exports
10 serves as the access control list for file systems which may be
11 exported to NFS clients.  It it used by both the NFS mount daemon,
12 .IR mountd (8)
13 and the NFS file server daemon
14 .IR nfsd (8).
15 .PP
16 The file format is similar to the SunOS
17 .I exports
18 file, except that several additional options are permitted.  Each line
19 contains a mount point and a list of machine or netgroup names allowed
20 to mount the file system at that point.  An optional parenthesized list
21 of mount parameters may follow each machine name.  Blank lines are
22 ignored, and a # introduces a comment to the end of the line. Entries may
23 be continued across newlines using a backslash.
24 .PP
25 .SS Machine Name Formats
26 NFS clients may be specified in a number of ways:
27 .IP "single host
28 This is the most common format. You may specify a host either by an
29 abbreviated name recognizued be the resolver, the fully qualified domain
30 name, or an IP address.
31 .IP "netgroups
32 NIS netgroups may be given as
33 .IR @group .
34 Only the host part of all
35 netgroup members is extracted and added to the access list. Empty host
36 parts or those containing a single dash (\-) are ignored.
37 .IP "wildcards
38 Machine names may contain the wildcard characters \fI*\fR and \fI?\fR.
39 This can be used to make the \fIexports\fR file more compact; for instance,
40 \fI*.cs.foo.edu\fR matches all hosts in the domain \fIcs.foo.edu\fR. However,
41 these wildcard characters do not match the dots in a domain name, so the
42 above pattern does not include hosts such as \fIa.b.cs.foo.edu\fR.
43 .IP "IP networks
44 You can also export directories to all hosts on an IP (sub-) network
45 simultaneously. This is done by specifying an IP address and netmask pair
46 as
47 .IR address/netmask .
48 .TP
49 .B =public
50 This is a special ``hostname'' that identifies the given directory name
51 as the public root directory (see the section on WebNFS in
52 .BR nfsd (8)
53 for a discussion of WebNFS and the public root handle). When using this
54 convention,
55 .B =public
56 must be the only entry on this line, and must have no export options
57 associated with it. Note that this does
58 .I not
59 actually export the named directory; you still have to set the exports
60 options in a separate entry.
61 .PP
62 The public root path can also be specified by invoking
63 .I nfsd
64 with the
65 .B \-\-public\-root
66 option. Multiple specifications of a public root will be ignored.
67 .PP
68 .SS General Options
69 .IR mountd " and " nfsd
70 understand the following export options:
71 .TP
72 .IR secure "\*d
73 This option requires that requests originate on an internet port less
74 than IPPORT_RESERVED (1024). This option is on by default. To turn it
75 off, specify
76 .IR insecure .
77 .TP
78 .IR ro
79 Allow only read-only requests on this NFS volume. The default is to
80 allow write requests as well, which can also be made explicit by using
81 the
82 .IR rw " option.
83 .TP
84 .I noaccess
85 This makes everything below the directory inaccessible for the named
86 client.  This is useful when you want to export a directory hierarchy to
87 a client, but exclude certain subdirectories. The client's view of a
88 directory flagged with noaccess is very limited; it is allowed to read
89 its attributes, and lookup `.' and `..'. These are also the only entries
90 returned by a readdir.
91 .TP
92 .IR link_relative
93 Convert absolute symbolic links (where the link contents start with a
94 slash) into relative links by prepending the necessary number of ../'s
95 to get from the directory containing the link to the root on the
96 server.  This has subtle, perhaps questionable, semantics when the file
97 hierarchy is not mounted at its root.
98 .TP
99 .IR link_absolute
100 Leave all symbolic link as they are. This is the default operation.
101 .SS User ID Mapping
102 .PP
103 .I nfsd
104 bases its access control to files on the server machine on the uid and
105 gid provided in each NFS RPC request. The normal behavior a user would
106 expect is that she can access her files on the server just as she would
107 on a normal file system. This requires that the same uids and gids are
108 used on the client and the server machine. This is not always true, nor
109 is it always desirable.
110 .PP
111 Very often, it is not desirable that the root user on a client machine
112 is also treated as root when accessing files on the NFS server. To this
113 end, uid 0 is normally mapped to a different id: the so-called
114 anonymous or
115 .I nobody
116 uid. This mode of operation (called `root squashing') is the default,
117 and can be turned off with
118 .IR no_root_squash .
119 .PP
120 By default,
121 .I nfsd
122 tries to obtain the anonymous uid and gid by looking up user
123 .I nobody
124 in the password file at startup time. If it isn't found, a uid and gid
125 of -2 (i.e. 65534) is used. These values can also be overridden by
126 the
127 .IR anonuid " and " anongid
128 options.
129 .PP
130 In addition to this, 
131 .I nfsd
132 lets you specify arbitrary uids and gids that should be mapped to user
133 nobody as well. Finally, you can map all user requests to the
134 anonymous uid by specifying the
135 .IR all_squash " option.
136 .PP 
137 For the benefit of installations where uids differ between different
138 machines, 
139 .I nfsd
140 provides several mechanism to dynamically map server uids to client
141 uids and vice versa: static mapping files, NIS-based mapping, and
142 .IR ugidd -based
143 mapping.
144 .PP
145 .IR ugidd -based
146 mapping is enabled with the 
147 .I map_daemon
148 option, and uses the UGID RPC protocol. For this to work, you have to run
149 the
150 .IR ugidd (8)
151 mapping daemon on the client host. It is the least secure of the three methods,
152 because by running
153 .IR ugidd ,
154 everybody can query the client host for a list of valid user names. You
155 can protect yourself by restricting access to
156 .I ugidd
157 to valid hosts only. This can be done by entering the list of valid
158 hosts into the
159 .I hosts.allow
160 or 
161 .I hosts.deny
162 file. The service name is
163 .IR ugidd .
164 For a description of the file's syntax, please read
165 .IR hosts_access (5).
166 .PP
167 Static mapping is enabled by using the
168 .I map_static
169 option, which takes a file name as an argument that describes the mapping.
170 NIS-based mapping queries the client's NIS server to obtain a mapping from
171 user and group names on the server host to user and group names on the
172 client.
173 .PP
174 Here's the complete list of mapping options:
175 .TP
176 .IR root_squash
177 Map requests from uid/gid 0 to the anonymous uid/gid. Note that this does
178 not apply to any other uids that might be equally sensitive, such as user
179 .IR bin .
180 .TP
181 .IR no_root_squash
182 Turn off root squashing. This option is mainly useful for diskless clients.
183 .TP
184 .IR squash_uids " and " squash_gids
185 This option specifies a list of uids or gids that should be subject to
186 anonymous mapping. A valid list of ids looks like this:
187 .IP
188 .IR squash_uids=0-15,20,25-50
189 .IP
190 Usually, your squash lists will look a lot simpler.
191 .TP
192 .IR all_squash
193 Map all uids and gids to the anonymous user. Useful for NFS-exported
194 public FTP directories, news spool directories, etc. The opposite option
195 is 
196 .IR no_all_squash ,
197 which is the default setting.
198 .TP
199 .IR map_daemon
200 This option turns on dynamic uid/gid mapping. Each uid in an NFS request
201 will be translated to the equivalent server uid, and each uid in an
202 NFS reply will be mapped the other way round. This option requires that
203 .IR rpc.ugidd (8)
204 runs on the client host. The default setting is
205 .IR map_identity ,
206 which leaves all uids untouched. The normal squash options apply regardless
207 of whether dynamic mapping is requested or not.
208 .TP
209 .IR map_static
210 This option enables static mapping. It specifies the name of the file
211 that describes the uid/gid mapping, e.g.
212 .IP
213 .IR map_static=/etc/nfs/foobar.map
214 .IP
215 The file's format looks like this
216 .IP
217 .nf
218 .ta +3i
219 # Mapping for client foobar:
220 #    remote     local
221 uid  0-99       -       # squash these
222 uid  100-500    1000    # map 100-500 to 1000-1500
223 gid  0-49       -       # squash these
224 gid  50-100     700     # map 50-100 to 700-750
225 .fi
226 .TP
227 .IR map_nis
228 This option enables NIS-based uid/gid mapping. For instance, when
229 the server encounters the uid 123 on the server, it will obtain the
230 login name associated with it, and contact the NFS client's NIS server
231 to obtain the uid the client associates with the name.
232 .IP
233 In order to do this, the NFS server must know the client's NIS domain.
234 This is specified as an argument to the
235 .I map_nis
236 options, e.g.
237 .IP
238 .I map_nis=foo.com
239 .IP
240 Note that it may not be sufficient to simply specify the NIS domain
241 here; you may have to take additional actions before
242 .I nfsd
243 is actually able to contact the server. If your distribution uses
244 the NYS library, you can specify one or more NIS servers for the
245 client's domain in
246 .IR /etc/yp.conf .
247 If you are using a different NIS library, you may have to obtain a
248 special
249 .IR ypbind (8)
250 daemon that can be configured via
251 .IR yp.conf .
252 .TP
253 .IR anonuid " and " anongid
254 These options explicitly set the uid and gid of the anonymous account.
255 This option is primarily useful for PC/NFS clients, where you might want
256 all requests appear to be from one user. As an example, consider the
257 export entry for
258 .B /home/joe
259 in the example section below, which maps all requests to uid 150 (which
260 is supposedly that of user joe).
261 .IP
262 .SH EXAMPLE
263 .PP
264 .nf
265 .ta +3i
266 # sample /etc/exports file
267 /               master(rw) trusty(rw,no_root_squash)
268 /projects       proj*.local.domain(rw)
269 /usr            *.local.domain(ro) @trusted(rw)
270 /home/joe       pc001(rw,all_squash,anonuid=150,anongid=100)
271 /pub            (ro,insecure,all_squash)
272 /pub/private    (noaccess)
273 .fi
274 .PP
275 The first line exports the entire filesystem to machines master and trusty.
276 In addition to write access, all uid squashing is turned off for host
277 trusty. The second and third entry show examples for wildcard hostnames
278 and netgroups (this is the entry `@trusted'). The fourth line shows the
279 entry for the PC/NFS client discussed above. Line 5 exports the
280 public FTP directory to every host in the world, executing all requests
281 under the nobody account. The
282 .I insecure 
283 option in this entry also allows clients with NFS implementations that
284 don't use a reserved port for NFS. The last line denies all NFS clients
285 access to the private directory.
286 .SH CAVEATS
287 Unlike other NFS server implementations, this
288 .I nfsd
289 allows you to export both a directory and a subdirectory thereof to
290 the same host, for instance 
291 .IR /usr " and " /usr/X11R6 .
292 In this case, the mount options of the most specific entry apply. For
293 instance, when a user on the client host accesses a file in 
294 .IR /usr/X11R6 ,
295 the mount options given in the 
296 .I /usr/X11R6 
297 entry apply. This is also true when the latter is a wildcard or netgroup
298 entry.
299 .SH FILES
300 /etc/exports
301 .SH DIAGNOSTICS
302 An error parsing the file is reported using syslogd(8) as level NOTICE from
303 a DAEMON whenever nfsd(8) or mountd(8) is started up.  Any unknown
304 host is reported at that time, but often not all hosts are not yet known
305 to named(8) at boot time, thus as hosts are found they are reported
306 with the same syslogd(8) parameters.