Configure AutoFS to auto-mount user home directories

On the client machine (cls-kvm2), install our AutoFS dependencies:

sudo apt-get install autofs oddjob-mkhomedir

Add a line to /etc/auto.master:

sudo sh -ec 'echo /nfs \\t/etc/auto.nfs >> /etc/auto.master'

Create and populate /etc/auto.nfs:

sudo sh -ec 'echo cls-kvm1 \\tcls-kvm1.itsm.unt.edu:/home >> /etc/auto.nfs'

Create and populate /etc/auto.home:

sudo sh -ec 'echo *\\tcls-kvm1.itsm.unt.edu:/home/\& >> /etc/auto.home'

Restart autofs and confirm there are no errors in the status of the service:

sudo service autofs restart
sudo service autofs status

Now that we have the client configured to auto mount our NFS filesystem, we can create and configure ownership of the exported home directories:

cd /nfs/cls-kvm1/
sudo mkdir /nfs/cls-kvm1/kevin
sudo chown -R kevin:kevin kevin
sudo chmod -R 750 kevin
sudo mkdir /nfs/cls-kvm1/olive
sudo chown -R olive:olive olive
sudo chmod -R 750 olive
sudo mkdir /nfs/cls-kvm1/tom
sudo chown -R tom:tom tom
sudo chmod -R 750 tom

Test authentication using su - kevin or su - olive:

su - kevin
Password: 
kevin@cls-kvm2:~$ 

You can confirm your home directory location using the pwd command:

kevin@cls-kvm2:~$ pwd
/nfs/cls-kvm1/kevin
kevin@cls-kvm2:~$ 

This completes the final lesson and the full tutorial.