Automount a windows share

automountcentos6cifs

I have this line and it works

mount -t cifs -o myuser //192.168.0.12/Public/Docs /mnt/cifs_shares/Docs

But then I try with autofs and it doesn't

In /etc/auto.master:

/mnt/cifs_shares/Docs       /etc/auto.cifs_shares

and in /etc/auto.cifs_shares

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

it seems that the thing gets mounted actually, but it turns to be empty.

When mounted with mount it's not empty at all

What am I missing ?

I'm on Centos 6.3 64 bits

Best Answer

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:

Related Topic