By do0m at 2005-08-04 01:48
NFS (Network File System) allows separate machines to mount partitions across the network. That is, it
allows you to mount remote filesystems on local machines like local drives.
This tutorial was tested with Gentoo and FreeBSD and mainly targeted at Linux, but it should work across
all platforms supported by NFS. If you need, refer to your documentation for details on your specific
platform. All the examples here should be modified to fit your network.
Setting up /etc/exports
Have your text editor at hand (I like nano or vim).
Before editing the exports file, you should view the man page (man exports).
The basic syntax of an exports entry looks something like this:
There are several options you can provide, depending on how you intend to
share your directory. A complete list of available options are listed in
the exports man page. Here's a brief summary:
no_root_squash: allows root access on the server
I find no_root_squash useful for administrative work on my machines, but it
can have some security implications. Be careful with root access, as always.
You can also use wildcard characters in these entries, though it would be
unwise to do so. (Allowing access to EVERYONE is quite dangerous.)
Setting up /etc/hosts.allow
You may already be familiar with hosts.allow.
The basic syntax of a hosts.allow entry is
You will need to make the following entries in your hosts.allow file for
(hosts) represents client machines. Multiple hosts must be separated by commas.
Setting up /etc/hosts.deny
The following entries are necessary in hosts.deny:
"ALL" excludes everyone who's not listed in /etc/hosts.allow.
This file follows the same basic syntax as hosts.allow.
Starting the daemons
These daemons may already be running for whatever reason. Check to see:
The daemons needed are nfsd, lockd, statd, mountd, and rquotad.
$ ps aux | grep (daemon)
Depending on your distro, these may be named differently.
NFS should be ready to accept connections. :)
Start the portmapper, lockd, and statd services on the client machine, and
begin enjoying your NFS setup.
At this point, you should redo all configuration files for your efficiency and security.
$ mount 192.168.0.100:/files /blahasdf/files
$ umount /files