Thu 16 Aug 2007
For a number of years I have run a Linux Laptop (Fedora core as it happens), and until recently my main PC has been windows. During that time I’ve wanted to share the files in my home directory on said laptop with my Windows system and have configured it as a Samba server. It’s worked like a dream and I have no complaints.
As you may have read, I recently converted my PC to Ubuntu and still wanted access to the folders on my laptop. So.. like an idiot I installed the samba client and ‘connected to the remote computer’ using SMB.
Like an idiot!
To recap, I have a Linux PC AND a Linux Laptop and I am using a WINDOWS file sharing protocol to connect the two! It dawned on me yesterday what a fool I was!
The answer was simple: NFS
D’oh!
So, time to loose the Windows protocol and do it the unix way…
First, setting up the laptop as a file server.
All I wanted was my home directory available to my main PC.
To configure NFS firstly I had to edit the /etc/exports on the server so I added the following (as root):
/home/matt 192.168.1.2(rw,sync,all_squash,anonuid=500)
/home/matt is the local directory I want to export
192.168.1.2 is the IP address of the computer allowed to connect (in this case my main PC)
rw means it’s read/write
sync means the server is not going to respond until its written to disk (safer, but marginally slower)
all_squash maps connecting users to anonymous
anonuid=500 sets the anonymous user uid as 500 (in this case my ID)
Saved the file and started the nfs service.
On the client, as root, I ran:
mount -o soft malachi:/home/matt /home/matt/malachi
soft means it’s a soft connection and my PC isn’t going to hang up if the laptop is turned off.
malachi:/home/matt is the name of my laptop and the folder it’s sharing.
/home/matt/malachi is the local folder on my PC that I want the directory on my laptop mounted on.
A quick ls -l /home/matt/malachi shows all my laptop files! Easy!
As I want it to mount on boot I added the following, as root, to the /etc/fstab (all on one line):
malachi:/home/matt /home/matt/malachi nfs rsize=8192,wsize=8192,timeo=14,intr,soft
Done!
I can now remove Samba and rely on good old NFS.