I’ve been messing around with some weird behavior on the Ubuntu 10.04 while setting up Autofs to auto mount some NFS shares from a remote server.
My setup
Server:
Debian Lenny (IP 192.168.1.123)
Standard NFS-server
A simple export setup (1 share) /mnt/storage
Client:
Ubuntu 10.04
Autofs 5.0.4-3.1ubuntu5
Autofs5 5.0.4-3.1ubuntu5
Autofs configuration
The first problem is this:
syntax error in nsswitch config near [ syntax error ]
This error message appears in my message log file on my client after installing Autofs. No configuration has yet been changed. So this is by default not working.
There are, as far as I have tested, two workarounds:
1: outcomment the line with ‘+auto.master’ at the bottom of the /etc/auto.master
2: insert a line with ‘automount:files’ in the /etc/nsswitch.conf
Now – restart autofs and verify that the error message is gone:
#sudo service autofs restart
The Autofs setup step 1
Edit /etc/auto.master and add a line like this:
/media/nfsshares /etc/auto.nfs
This will tell autofs to create a folder named nfsshares inside the /media/ folder and that there are further configuration entries in the file /etc/auto.nfs
The Autofs setup step 2
Create a file called auto.nfs in the /etc/ folder and edit it with your favorite editor:
# vim /etc/auto.nfs
Enter one or more shares like this:
myservershare 192.168.1.123:/mnt/storage
Save the file and we are done.
Starting and testing Autofs
All options are now created, so lets (re)start Autofs and move on:
# service autofs restart
The Autofs is now running and we should see a newly created folder inside your /media directory:
# cd /media # ls -al ... drwxr-xr-x 3 root root 0 2010-07-15 21:22 nfsshares ...
Try to change directory to the nfsshares folder:
# cd nfsshares # ls -al
What the …. It’s empty. Where is the myservershare folder? Don’t worry, just try and cd’e into the folder:
# cd myservershare
Well well well. The directory is now accessible and visible.
If you would like the directory structure to be visible at all times – even at first entry – add the ghost parameter to the auto.master like this:
/media/nfsshares /etc/auto.nfs --ghost
The Autofs is now up and running.

juli 20th, 2010 at 15:08
+auto.master is by default uncommented in 10.04 when i just apt-got autofs?
…i found the page due to error but it appears to still work, my problem was the mounted dir not being visibile until I changed into the dir, the –ghost fixed that , thanks!