1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396
|
The LINUX User-Space NFS Server(1)
Version 2.2
December 22, 1997
____________________
1. This is a rewrite of the original README file (which you
can now find in README.HISTORIC).
- 1 -
1. Overview
This package contains all necessary programs to make your
Linux machine act as an NFS server, being an NFS daemon
(rpc.nfsd), a mount daemon (rpc.mountd), optionally, the uid
mapping daemon (rpc.ugidd), and the showmount utility. It
was originally developed by Mark Shand, and further enhanced
by Donald Becker, Rick Sladkey, Orest Zborowski, Fred van
Kempen, and Olaf Kirch.
Unlike other NFS daemons, the Linux nfsd runs entirely in
user space. This makes it a tad slower than other NFS
implementations, and also introduces some awkwardnesses in
the semantics (for instance, moving a file to a different
directory will render its file handle invalid).
2. Building and installing unfsd
To compile and install the programs in this package, you
first have to run the BUILD script. It will ask you a couple
of questions about your preferred configuration. It tries to
be helpful by informing you about why it asking you which
question, but a brief overview may be useful nevertheless:
uid/gid mapping: Occasionally, you will want to serve NFS
clients whose assignment of uids and gids to user names
differs from that on the client. The unfsd package
offers you several mechanisms to dynamically map the
client's uid space to that of the server, and vice
versa:
static mapping: In the exports file, you can provide
the NFS daemon with a file that describes how
individual or entire ranges of uids and gids on a
client machine correspond to those of the server.
NIS mapping: The NFS daemon is also able to query the
NIS server of the NFS client for the appropriate
uids and gids, using the user or group names and
looking them up in the appropriate NIS maps. You
can do this by specifying the client's NIS domain
in the exports file. In addition, you may have to
edit the /etc/yp.conf file to point your NIS
library to the server for that NIS domain (if
you're using NYS).
ugidd mapping: This is the original mechanism by which
unfsd supported dynamic uid/gid mapping. For this,
you need to run the rpc.ugidd daemon on the client
machine, and instruct the server in the exports
file to use it.
While this is convenient, it also presents a
- 2 -
security problem because rpc.ugidd can be abused
by attackers to obtain a list of valid user names
for the client machine. This can be helped
somewhat by making ugidd check the requester's IP
address against the hosts.allow and hosts.deny
files also used by the tcpd wrapper program (see
below).
The BUILD script will ask you whether you want dynamic
ugidd- or NIS-based uid mapping. If you disable ugidd-
mapping, the daemon will not be compiled, and the
manpage will not be installed.
file access control: For security reasons, mountd and nfsd
make sure that vital files such as /etc/exports are
owned by the correct user and have an appropriate
access mode. BUILD will ask you which user and group
should own exports. By default, this will be
root/root.
daemon access control: Both rpc.mountd and rpc.ugidd can be
configured to use the access control features of the
TCP wrappers package. This will let you specify in the
/etc/hosts.allow and hosts.deny files which hosts are
allowed to talk to the daemons at all. Note that you
still have to configure access control as described
below.
If you do enable host access checking for rpc.ugidd,
the BUILD script will try to locate libwrap.a which is
needed for this. This library is part of Wietse
Venema's TCP wrapper package. BUILD looks in several
standard locations such as /usr/lib. If it does not
find the library (e.g. because you keep it in weird
places like /usr/i486-linux/lib), it will ask you for
its full path name.
mount request logging: If you enable this option, rpc.mountd
will log all attempts to mount a directory via NFS from
your server machine. This is very helpful in monitoring
NFS server usage, and for catching attempts at attcking
your machine via NFS.
When enabled, mountd will log all successful mount
attempts to syslog's daemon facility at level notice.
Failed mount attempts are logged at level warning.
After completing these questions, BUILD will run a configure
script to detect certain system capabilities. This will take
a while on your first attempt. Repeated invocations of
configure will run a lot faster because the results of the
tests are cached. If you want to start out with a fresh
build on a different release of Linux, you should make sure
to get rid of these cached values by running `make
- 3 -
distclean' first.
You can then compile and install nfsd by typing `make'
and/or (as root) `make install.' This will also install the
manual pages.
3. Configuring nfsd
To turn your Linux box into an NFS server, you have to start
the following programs from /etc/rc.d/rc.inet2 (or wherever
your favorite Linux distribution starts network daemons
from):
* rpc.portmap
* rpc.mountd
* rpc.nfsd
* rpc.ugidd (optional)
* rpc.pcnfsd (optional, not contained in this package)
To make directories available to NFS clients, you have to
enter them in your exports file along with the hosts allowed
to mount them. The list of options and a sample file are
given in the exports(5) manual page (and the whole topic is
covered quite extensively in the Linux Network
Administrator's Guide anyway), so I will not discuss this
here. If somebody feels like filling in the missing parts
here, please send me the diffs.
4. Configuring network access control
To protect rpc.ugidd or rpc.mountd from unauthorized access,
you just have to add lines to /etc/hosts.allow and/or
/etc/hosts.deny detailing which hosts are allowed to talk to
it. If your NFS server has the IP address 193.175.30.33, you
would add the following to hosts.allow and hosts.deny,
respectively:
# hosts.allow:
rpc.ugidd: 193.175.30.33
# hosts.deny:
rpc.ugidd: ALL
If you have compiled the TCP wrappers package with OPTIONS
support (which I highly recommend), you can also put the
following into hosts.allow, which will have the same effect:
rpc.ugidd: ALL EXCEPT 193.175.30.33 : deny
- 4 -
Similarly, you can limit access to rpc.mountd on the NFS
server host. The daemon identifier to be used in this case
is rpc.mountd.
5. Running several Daemons Concurrently
For a long time, unfsd has not supported multiple NFS
processes at all. This is paramount to good NFS
performance, however, as it allows other you to service NFS
requests in parallel. Then, for a while, it supported
multiple server processes in read-only mode (which was quite
easy as there is no need to synchronize the file handle
caches between daemon processes in that case).
Starting with release 2.2beta32, unfsd also supports
multiple server processes in read/write mode. Note that this
code is still experimental, and may disappear again if the
concept doesn't work, or is too slow.
6. Common Problems (a.k.a. Dependencies)
* Root squashing is enabled by default, which means that
requests from the root user are treated as if they
originated from the nobody user. If you want root on
the NFS client to be able to access files with full
prvilege, you have to add no_root_squash to the option
list in /etc/exports.
* The most specific entry applies. This means if you
export both /usr and /usr/local to a client, and the
client mounts /usr from the server, the options for
/usr/local will still apply when the client accesses
* Wildcards in client names only do not match dots. This
means that the entry *.foo.com only matches hosts named
joe.foo.com etc, but not joe.sales.foo.com. You may
call this a bug (and I may replace the current pattern
matching code with wildmat if there is enough demand).
* Changes to the exports file do not take effect until
both nfsd and mountd have re-read the file. You either
have to kill both daemons and restart them, or send
them a HUP signal:
# killall -HUP rpc.mountd rpc.nfsd
* NFS operation between two Linux boxes can be quite
slow. There are a number of reasons for this, only one
of which is that unfsd runs in user space. Another
(and much worse) problem is that the Linux NFS client
code currently does no proper caching, read-ahead and
write-behind of NFS data. This problem can be helped
- 5 -
by increasing the RPC transfer size on the client by
adding the `rsize=8192,wsize=8192' mount options. This
will at least improve throughput when reading or
writing large files. You are still in a lose-lose
situation when applications write data line by line or
with no output buffering at all.
7. Copyright
Much of the code in this package was originally written by
Mark Shand, and is placed under the following copyright:
This software may be used for any purpose provided
the above copyright notice is retained. It is
supplied as is, with no warranties expressed or
implied.
Other code, especially that written by Rick Sladkey and some
replacement routines included from the GNU libc, are covered
by the GNU General Public License, version 2, or (at your
option) any later version.
8. Bug Reports
If you think you have encountered a bug in nfsd or any of
the other programs in this package, please follow the
instructions in the file BUGS.
|