07.06.2014 Views

2 - Raspberry PI Community Projects

2 - Raspberry PI Community Projects

2 - Raspberry PI Community Projects

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

options lockd nlm_udpport=2045 nlm_tcpport=2045<br />

Example 11.25<br />

The /etc/modprobe.d/lockd file<br />

Once these parameters are set, it becomes easier to control access to the NFS service from the<br />

firewall in a fine-grained way by filtering access to ports 111 and 2045 through 2049 (both UDP<br />

and TCP).<br />

11.4.2. NFS Server<br />

The NFS server is part of the Linux kernel; in kernels provided by Debian it is built as a kernel<br />

module. If the NFS server is to be run automatically on boot, the nfs-kernel-server package should<br />

be installed; it contains the relevant start-up scripts.<br />

ALTERNATIVE<br />

The nfs-user-server server<br />

nfs-user-server is an NFS server running as a traditional server, with a userspace<br />

program and not a kernel module. This version of NFS is mostly obsolete<br />

since the kernel-based NFS server is now mature and reliable.<br />

The NFS server configuration file, /etc/exports, lists the directories that are made available<br />

over the network (exported). For each NFS share, only the given list of machines is granted<br />

access. More fine-grained access control can be obtained with a few options. The syntax for<br />

this file is quite simple:<br />

/directory/to/share machine1(option1,option2,...) machine2(...) ...<br />

Each machine can be identified either by its DNS name or its IP address. Whole sets of machines<br />

can also be specified using either a syntax such as *.falcot.com or an IP address range such as<br />

192.168.0.0/255.255.255.0 or 192.168.0.0/24.<br />

Directories are made available as read-only by default (or with the ro option). The rw option<br />

allows read-write access. NFS clients typically connect from a port restricted to root (in other<br />

words, below 1024); this restriction can be lifted by the insecure option (the secure option is<br />

implicit, but it can be made explicit if needed for clarity).<br />

By default, the server only answers an NFS query when the current disk operation is complete<br />

(sync option); this can be disabled with the async option. Asynchronous writes increase performance<br />

a bit, but they decrease reliability since there's a data loss risk in case of the server<br />

crashing between the acknowledgment of the write and the actual write on disk. Since the default<br />

value changed recently (as compared to the historical value of NFS), an explicit setting is<br />

recommended.<br />

In order to not give root access to the filesystem to any NFS client, all queries appearing to come<br />

from a root user are considered by the server as coming from the anonymous user. This behavior<br />

corresponds to the root_squash option, and is enabled by default. The no_root_squash<br />

278 The Debian Administrator's Handbook

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!