browser icon
You are using an insecure version of your web browser. Please update your browser!
Using an outdated browser makes your computer unsafe. For a safer, faster, more enjoyable user experience, please update your browser today or try a newer browser.

NFS in Ubuntu

Posted by on July 4, 2008

NFS in Ubuntu

nstalling the NFS Server
Install and configure nfs-server and portmap (all on one line)

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

Make sure that portmap is not bound to localloop/127.0.0.1

sudo vi /etc/default/portmap
sudo /etc/init.d/portmap restart

NFS Server Configuration
NFS exports from a server are controlled by the file /etc/exports. Each line begins with the absolute path of a directory to be exported, followed by a space-seperated list of allowed clients.

Here are some quick examples of what you could add to your /etc/exports
For Full Read Write Permissions allowing any computer from 192.168.1.1 through 192.168.1.255

/files 192.168.1.1/24(rw,no_root_squash,sync)

Or for Read Only from a single machine

/files 192.168.1.2 (ro,sync)

Note: A client can be specified either by name or IP address. Wildcards (*) are allowed in names, as are netmasks (e.g. /24) following IP addresses, but should usually be avoided for security reasons. A client specification may be followed by a set of options, in parenthesis. It is important not to leave any space between the last client specification character and the opening parenthesis, since spaces are intrepreted as client seperators.

After editing exports, using the following command

sudo exportfs -a

To see what you are exporting

sudo showmount –exports

To see what mounts are currently being used

sudo showmount –all

Install NFS client support in Ubuntu

sudo apt-get install portmap nfs-common

This will install all the required packages for nfs client
You can then mount a share by hand using the following command

sudo mount server.mydomain.com:/files /files

Or you can add it to your /etc/fstab like this (on one line)

server.mydomain.com:/files /files nfs rsize=8192,wsize=8192,timeo=14,intr

Once added to your fstab you can mount it like this

sudo mount /files

Firewall Ports for NFS
If you have a firewall you need to make sure ports 32771, 111 and 2049 are open

Sources:

1. www.ubuntugeek.com
2. man exports

Comments are closed.