13.07.2015 Views

Linux System Administration Recipes A Problem-Solution Approach

Linux System Administration Recipes A Problem-Solution Approach

Linux System Administration Recipes A Problem-Solution Approach

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CHAPTER 2 ■ CENTRALIZING YOUR NETWORK: KERBEROS, LDAP, AND NFS2-14. Using NFS and automountA basic NFS shared directory is usually very straightforward to set up. To share the /local/ directory toany other machine in the 10.1.0.* subnet, edit the /etc/exports file on the machine that the sourcedrive is on (let’s call it server1):/local 10.1.0.*rwThen restart the NFS server (/etc/init.d/nfs-kernel-server restart). Next mount the drive fromany other machine in that subnet, on that machine’s /mnt directory, with this:mount server1:/local /mntTo set this up to mount automatically on boot, add it to /etc/fstab:/mnt server1:/local nfs defaults 0 2However, a more flexible approach than manual mounting is to use automount. With this, drives areautomatically mounted on request, rather than being mounted all the time (as with the previous setup).You can set up a central home disk on your server and have that automounted on request. Theadvantages to a central home disk are fairly obvious: anyone can work on any machine, and backups aremade easier. If it’s automounted, then it won’t affect the bootup procedure if there’s a problem of somesort with the server.Install the package on the client:apt-get install autofsThen edit the /etc/auto.master file on the client to have this line:/home -rw server1:/export/homeRestart autofs, and then type cd /mnt/server. The directory should appear and list correctly.Automounting really comes into its own if you get your automount maps from your LDAP server.Partly, this has the usual centralization advantage that if a mapping changes, you need to change it onlyonce, in one place, not on all your machines. But it also means that you can set up home directorymappings individually (per directory) rather than the home directory as a whole, but without having tohave unwieldy swathes of mappings.Install the autofs-ldap package, and edit your /etc/auto.master file to read as follows:/homeldap:automountMap=auto.home,dc=ph,dc=ic,dc=ac,dc=ukThen log into the LDAP server. You’ll need to add one parent map entry, for the directory map as awhole, and then individual per-user maps. The LDIF file here describes the parent map and one usermap:dn: ou=auto.home,dc=example,dc=comobjectClass: topobjectClass: automountMapou: auto.home59Download at WoweBook.Com

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!