I have this setup
Client: Centos 7.6.1810 up to date
Server: Windows 7 pro
AutoFS Configuration
# tail -1 /etc/auto.master
/srv/xray /etc/auto.xray
# cat /etc/auto.xray
cdm8240 -fstype=cifs,ro,vers=2.0,credentials=/etc/auto.smb.cdm8-240.credentials ://my.server/share/
# cat /etc/auto.smb.cdm8-240.credentials
username=mylogin
password=passpass123
if I mount this share manually, everything is fine
# mount.cifs -o ro,vers=2.0,credentials=/etc/auto.smb.cdm8-240.credentials //my.server/share/ /srv/xray/
# ls -l /srv/xray/ | wc -l
34
# umount /srv/xray/
If I try with autofs, I have this wrong mount entry.
/etc/auto.xray on /srv/xray type autofs (rw,relatime,fd=17,pgrp=71348,timeout=300,minproto=5,maxproto=5,indirect,pipe_ino=404555)
Then I tried to pre-create the mount point cdm8240
in the /srv/xray/ folder...
# ls -ld /srv/xray/cdm8240/
drwxrwxrwx 2 root root 6 Jun 6 08:17 /srv/xray/cdm8240/
...reload autofs and access the share and it works
# systemctl restart autofs
# ls -l /srv/xray/cdm8240/ | wc -l
34
But now here is the weird part, if I restart autofs, it dismounts the share and remove the cdm8240 folder!
# systemctl restart autofs
# find /srv/xray/ -ls
406293 0 drwxr-xr-x 2 root root 0 Jun 6 08:20 /srv/xray/
And even changing the perms on /srv/xray/, leaving it with 755 instead of the 777 it has before! And I come back to the first situation and it's wrong mount entry.
Update 1
Tried with the "direct" mode and it looks fine now
# tail -1 /etc/auto.master
/- /etc/auto.xray
# cat /etc/auto.xray
/test/cdm8240 -fstype=cifs,ro,credentials=/etc/.cdm8240cred,vers=2.1,file_mode=0775,dir_mode=0775,users ://my.server/share
so, is it a bug in the indirect mode or something "normal"?
Update 2
As explained bellow, everything was fine. I added --ghost
option in my auto.master file as follow
/srv/autofs/xray /etc/auto.xray --ghost
now the share is displayed and everything is working fine.