Enable the following options in the kernel configuration (choose
client and/or server support as appropriate) and recompile the
kernel if necessary:
File systems --->
[*] Network File Systems ---> [CONFIG_NETWORK_FILESYSTEMS]
<*/M> NFS client support [CONFIG_NFS_FS]
<*/M> NFS server support [CONFIG_NFSD]
Select the appropriate sub-options that appear when the above
options are selected.
In BLFS we assume that nfs v3 will be used. If the server offers nfs v4 (for linux,
CONFIG_NFSD_V4) then auto-negotiation for v3 will fail and you
will need to add
nfsver=3 to the
mount options. This also applies if that option is enabled in the
client's kernel, for
example in a distro trying to mount from a BLFS v3 server.
of NFS Utilities
Before you compile the program, ensure that the
nobody user and
nogroup group have been created as done in the
current LFS book. You can add them by running the following
commands as the
groupadd -g 99 nogroup &&
useradd -c "Unprivileged Nobody" -d /dev/null -g nogroup \
-s /bin/false -u 99 nobody
The classic uid and gid values are 65534 which is also -2 when
interpreted as a signed 16-bit number. These values impact other
files on some filesystems that do not have support for sparse
nogroup values are relatively
arbitrary. The impact on a server is nil if the
exports file is configured correctly. If it is
misconfigured, an ls
-l or ps listing will show a uid or
gid number of 65534 instead of a name. The client uses
nobody only as the user running
Install NFS Utilities by running
the following commands:
./configure --prefix=/usr \
/usr directory is NFS
mounted, you should install the executables in
/sbin by passing an additional parameter
--sbindir=/sbin to the above
Now, as the
make install &&
chmod u+w,go+r /sbin/mount.nfs
The tests for this package require that the package be installed
and configured as specified below. In addition, the the daemon from
rpcbind-0.2.4 needs to be running and the tests
need to be run as the
To test the results, issue, as root: make check.
This option is needed because TCP Wrappers is not in BLFS.
allows the package to be built when libnfsidmap has not been
support for RPCSEC GSS (RPC Security).
Configuring NFS Utilities
/etc/exports contains the exported
directories on NFS servers. Refer to the
exports.5 manual page for the syntax of this
file. Also refer to the "NFS HowTo" available at http://nfs.sourceforge.net/nfs-howto/
for information on how to configure the servers and clients in a
secure manner. For example, for sharing the
/home directory over the local network, the
following line may be added:
Be sure to replace the directory, network address. and prefix
above to match your network. The only space in the line above
should be between the directory and the network address.
Install the NFSv4 server units included in the
package to start the server at boot.
If you have disabled NFSv4 support, run the following command
root user to omit the
NFSv4 specific systemd units:
You can edit the
/etc/default/nfs-utils file to change the
startup options for NFS daemons. Defaults should be fine for
most use cases.
/etc/fstab contains the directories
that are to be mounted on the client. Alternately the partitions
can be mounted by using the mount command with the proper
options. To mount the
/usr partitions, add the following
<server-name>:/home /home nfs rw,_netdev 0 0
<server-name>:/usr /usr nfs ro,_netdev 0 0
The options which can be used are specified in man 5 nfs. If both the client
and server are running recent versions of linux, most of the
options will be negotiated. You can specify either
_netdev if the filesystem is to be
automatically mounted at boot, or
noauto (and perhaps
user) for other filesystems.
If the fileserver is not running a recent version of linux, you
may need to specifiy other options.
If you are using systemd, you may need to enable autofs v4 in
your kernel, and add the option
comment=systemd.automount. Some machines need
this, because systemd tries to mount the external fs's before the
network is up, others do not need it. An alternative is for
root to run mount -a.
The following systemd units are not required if
the nfs-server units are installed.
Install the units included in the blfs-systemd-units-20160602 package to
start the client services at boot.