Setup NFS on Ubuntu Linux

The setup is pretty trivial, but configuration has few glitches.


The “server” machine – the one providing its disk(s) for access – needs to have nfs-kernel-server installed.

$ sudo apt-get install nfs-kernel-server

This will along the way install all necessary packages.

On the client machine – the one connecting to the server, – you need just the nfs-common package; this already includes all files needed for the client connections.

$ sudo apt-get install nfs-common


On the server machine, you have to choose what you want to share; these folders you have to list in the /etc/exports file (edit as root using your fave editor) in the following format:

/home/user    10.0.0.*(rw,sync,no_root_squash)
/   ,sync,all_squash,anonuid=0,anongid=0)

The above example will export /home/user for reading and writing to all computers in the network, and read only access to root (/) from See also /etc/exports man page.

Then you have to export the definitions and restart the nfs server twice for the changes to take effect (don’t ask me why twice). Run

$ sudo exportfs
$ sudo /etc/init.d/nfs-kernel-server restart
$ sudo exportfs
$ sudo /etc/init.d/nfs-kernel-server restart

Mounting the Remote Disk(s)

On the client machine you can now mount the remote NFS disk:

$ mkdir remote-disk
$ sudo mount remote-disk

provided is the IP of the NFS server. Now ls remote-disk will show you content of the /home/user folder on the server machine.

One response to “Setup NFS on Ubuntu Linux

  1. Pingback: Setup NFS on Ubuntu Linux « JustChecking's Weblog On All | unixsecure secondary

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s