NFS file sharing

2008/05/01 by Paulo Pereira

~/categories/Linux #Linux #Ubuntu

Here’s how you share files between two Linux machines, using NFS.

Installation

Configuration in machine 1 (where the shared folder is)

sudo vi /etc/exports
/home/mach1user/Public *(ro,sync)
/home/mach1user/Documents 100.000.00.01(ro,sync,no_subtree_check)
/home/mach1user/Share 100.000.00.01/20(rw,sync,no_subtree_check)
sudo exportfs -a

Configuration in machine 2 (where the shared folder are going to be accessed)

mkdir /home/mach2user/HomeNetwork/Public
mkdir /home/mach2user/HomeNetwork/Documents
mkdir /home/mach2user/HomeNetwork/Share
sudo mount 100.000.0.05:/home/mach1user/Public /home/mach2user/HomeNetwork/Public
sudo mount 100.000.0.05:/home/mach1user/Documents /home/mach2user/HomeNetwork/Documents
sudo mount 100.000.0.05:/home/mach1user/Share /home/mach2user/HomeNetwork/Share
sudo vi /etc/fstab
100.000.0.05:/home/mach1user/Public /home/mach2user/HomeNetwork/Public nfs ro,hard,intr 0 0
100.000.0.05:/home/mach1user/Documents /home/mach2user/HomeNetwork/Documents nfs ro,hard,intr 0 0
100.000.0.05:/home/mach1user/Share /home/mach2user/HomeNetwork/Share nfs ro,hard,intr 0 0

And that should do it.