Thursday, May 1, 2008

NFS file sharing

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

  • Go to the Synaptic Package Manager
  • Find nfs-kernel-server and install

Configuration in machine 1 (where the shared folder is)
  • Define the shares you want to provide
$ sudo vi /etc/exports
  • Add your shares to the file
/home/mach1user/Public *(ro,sync)
  • Make your changes be known
$ sudo exportfs -a

Configuration in machine 2 (where the shared folder are going to be accessed)
  • Create a folder, where the share will be mounted
$ mkdir /home/mach2user/HomeNetwork/Public
$ mkdir /home/mach2user/HomeNetwork/Documents
$ mkdir /home/mach2user/HomeNetwork/Share
  • Mount the shares (the IP is from machine 1)
$ sudo mount /home/mach2user/HomeNetwork/Public
$ sudo mount /home/mach2user/HomeNetwork/Documents
$ sudo mount /home/mach2user/HomeNetwork/Share
  • Make the shares available after rebooting
$ sudo vi /etc/fstab
  • Add to the file (the IP is from machine 1) /home/mach2user/HomeNetwork/Public nfs ro,hard,intr 0 0 /home/mach2user/HomeNetwork/Documents nfs ro,hard,intr 0 0 /home/mach2user/HomeNetwork/Share nfs ro,hard,intr 0 0

And that should do it.

No comments:

Post a Comment