Friday, October 17, 2008

Using NFS to make home directories available centrally

Lets say we have 3 servers and are heading towards an LDAP kind of configuration where we want to have a single sign on our servers. The first step is to export the /home directories from each server that is holding user directories.

This is a work in progress of course and the reason for this setup is because I already have a server with users on it. So, S1 and S2 are servers with existing users on them. LD is the server that we want all home directories on. All these servers have static IPs, S1 has, S2 and LD

On S1 and S2 we install nfs server and portmap:

sudo apt-get install portmap nfs-kernel-server
Then we edit the /etc/exports:

The first part (/home) is the directory that you want to share or export to the central server. The IP address ( is the address that is allowed to access this share. I recommend that you use IPs and not IP ranges with subnets.
And we activate the exports. Every time you edit /etc/exports you need to run this command:
sudo exportfs -ra
Now on the central server (LD) we need to install the nfs client services:

sudo apt-get install portmap nfs-common
Next, create EMPTY directories on LD to use as mount points

sudo mkdir /homeS1
sudo mkdir /homeS2
We will need to mount statically the directories that we are sharing from S1 and S2 so on LD we edit the /etc/fstab file. At the bottom of the file we add these entries: /homeS2 nfs rw,hard,intr 0 0 /home /homeS1 nfs rw,hard,intr 0 0
We save and exit the file and run the following command.

sudo mount -a
We are all set. If we go to /homeS1 on LD we will see all home directories from S1. Next is the challenge of adding an LDAP configuration that will hopefully come next.

No comments:

My Blog List