Sharing Files Using NFS (Linux's Network File System)

This guide shows you how to quickly and easily set up a network share using NFS on Linux.  The share won't be secured in any way, so only use it on a local network - don't share the files with the internet (unless you really want to!)  [For more in-depth instructions, this is quite a good guide]

Server

Firstly install the NFS server:

sudo apt-get install rpcbind nfs-kernel-server

Now add a line to the /etc/exports file - one for each directory you want to share: (the following options are the ones I use, more can be found here).

/media/usbdrive 192.168.1.0/24(rw,sync,no_root_squash,no_subtree_check,insecure)

This shares the files at /media/usbdrive with any computer on the local network (assuming the network is using addresses 192.168.1.1 - 192.168.1.255).

Now "export" the directories, and restart the NFS service:

sudo exportfs -ra
sudo service nfs-kernel-server restart

Client

Install the NFS client:

sudo apt-get install rpcbind nfs-common

Now create a local directory to mount the remote directory into, e.g.:

mkdir -p ~/media/nfsdrive

And mount the files (substituting the correct IP address for the server, and remote/local paths appropriately):

sudo mount -t nfs 192.168.1.10:/media/usbdrive /home/username/media/nfsdrive

To unmount, simply use:

sudo umount /home/username/media/nfsdrive