automount a windows share

I had similar problems with mounting a CIFS share on CentOS 6.3 64-bit - the documentation I found doesn't seem to document two additional arguments that need to be set up in the auto.master file for this to work.

Here's what worked for me and might likely work for you (modified a little to fit your example):

At bottom of /etc/auto.master:

/mnt/cifs_shares     /etc/auto.cifs_shares     --timeout=600     --ghost

In /etc/auto.cifs_shares:

Docs     -fstype=cifs,rw,noperm,credentials=/etc/credentials.txt     ://192.168.0.12/Public/Docs

Then do a:

service autofs restart

Now, if you do:

ls /mnt/cifs_shares/Docs

And you have the correct permissions, username/password, etc. you should see your files in the share. Note that the first item in the auto.cifs_shares file 'Docs' is the name of the share that appears in the /mnt/cifs_shares folder.

Otherwise, look for error messages for further debugging:

tail -n 50 /var/log/messages

Here's another reference that seems to work:

  • See the "Automounting" section of https://web.archive.org/web/20140703174307/http://www.lamolabs.org/blog/6000/one-liner-mounting-a-smbcifs-share-as-an-automount-on-centosfedorarhel/