autofs mounts in parent directory
For many years I have a problem with autofs, now. I thought there was a bug in the autofs version in my repository. Unfortunately, even after several system as well as distribution upgrades covering several major kernel as well as autofs releases I still have the following unexpected behavior.
First, let's mount manually and successfully my NFS share:
$ mount sarabi:/export/public_html /tmp/mnt
$ ls -al /tmp/mnt
drwxr-sr-x+ 3 root www-data 4096 Apr 21 19:18 .
drwxrwxrwt 10 root root 4096 Apr 22 15:39 ..
drwxr-s---+ 2 markus www-data 4096 Apr 21 19:18 markus
After checking that my share works, we will try to automate it via autofs.
$ cat /etc/auto.master
+dir:/etc/auto.master.d
+auto.master
/mnt/ /etc/auto.mnt --timeout=1800 --ghost
$ cat /etc/auto.mnt
public_html sarabi:/export/public_html
$ ls -al /mnt # as expected
drwxr-xr-x 3 root root 0 Apr 22 15:48 .
drwxr-xr-x 22 root root 4096 Apr 22 14:27 ..
dr-xr-xr-x 2 root root 0 Apr 22 15:48 public_html
$ ls -al /mnt/public_html # unexpected
ls: cannot access '/mnt/public_html/': Too many levels of symbolic links.
$ ls -al /mnt # Why is public_html mounted into /mnt?!?
drwxr-sr-x+ 3 root www-data 4096 Apr 21 19:18 .
drwxr-xr-x 22 root root 4096 Apr 22 14:27 ..
drwxr-s---+ 2 markus www-data 4096 Apr 21 19:18 markus
Why did autofs mount directly the indirect mount public_htlm
into /mnt
?!?
Solution 1:
After so many years I was able to solve the issue. The problem was just a redundant /
in the mount point. So, the working master configuration file has to look as follows:
$ cat /etc/auto.master
+dir:/etc/auto.master.d
+auto.master
/mnt /etc/auto.mnt --timeout=1800 --ghost