NFS (Network File System) is a protocol used by UNIX/Linux computers to share disks across a network. Similar to the Common Internet File Services (CIFS) protocol used by Windows, NFS is older and more light-weight, and performs much more efficiently on UNIX and Linux systems.
Setting up an NFS share
As an example, we’ll be sharing the /home directory with all clients on a network. Sharing /home is a good idea if you’re running the Network Information Service (NIS) server that I covered in the May issue, as it allows you to use the same desktop and configuration settings on every computer attached to your network.
First, open /etc/exports as root using your favourite text editor. If this file doesn’t exist you will need to create it. Add the following to the file:
This line shares the /home directory with all machines on the 192.168.1.0 network and allows each machine to have both read and write access to the share. Change this network address to one that is appropriate for your network. Read only access can be specified by changing (rw) to (ro).
You can individually specify a list of machines that will have access to the share, and tailor the access each machine has to the share, using a line such as:
/home 192.168.1.2(rw) 192.168.1.3(ro)
In this example, 192.168.1.2 has both read and write access to the share while 192.168.1.3 has only read access. Any other machine on your network will be unable to mount the share.