Ubuntu Reference Guide

part of the WillPowered Inc. network
© 2011 William Hall <5/> - This site uses HTML5

Applications\NFS

First you must install the server packages.

$ sudo apt-get install portmap nfs-kernel-server

Now decide which directories to share using NFS.

$ sudo nano /etc/exports

Use the following lines to add NFS shares in a variety of styles.

/path/to/directory 192.168.1.2(ro,insecure,async,no_subtree_check) 192.168.1.3(ro,insecure,async,no_subtree_check) /path/to/other/directory 192.168.1.0/255.255.255.0(ro,insecure,sync,no_subtree_check)

These are read only examples, replace ro with rw to enable writing. Obviously mentioning IPs only really works if the target computers use static IPs. The insecure option means that NFS doesn't care about the user ID which makes Ubuntu to Mac NFS connections work much better.

To create NFS exports accessible to any computer use the following syntax:

/path/to/a/directory 192.168.1.0/24(ro,insecure,async,no_subtree_check)

Whenever you change the exports file, run the following command.

$ sudo exportfs -ra

For clients, you must install extra packages.

$ sudo apt-get install portmap nfs-common

I prefer to mount the NFS shares at boot so I add the following line to /etc/fstab.

ip.address.of.server:/path/to/share/on/server /mount/path nfs ro,soft,intr 0 0

Again, swap ro for rw if you want to write.

It is possible for an ubuntu installation to be both server and client.

Reference here