2

I need a suggestion how to configure autofs to mount a windows share automatically to CentOS.

I can successfully mount the share, but I can't seem to enter parameters into auto.master corectly.

Could someone look at my mount command (which executes correctly) and advise me what to put into auto.master?

mount -t cifs -o username=user,password=pass,rw,dir_mode=0777,file_mode=0777 //server1/resources/50004 /var/www/html/resources/50004

The mount parameters must be the same. I want to use auto.master and auto.50004files. Nothing else will be mounted, just the one directory above. What should I put into auto.master and what into auto.50004?

Here is my auto.master:

/misc /etc/auto.misc
/net -hosts
+auto.master
/var/www/html/resources/50004 /etc/auto.50004

And my auto.50004:

/50004 -fstype=cifs,rw,user=user,pass=password,file_mode=0777,dir_mode=0777 ://server1/resources/50004

Could someone please have a look, this is driving me mad

  • Take a look at "man 5 autofs" and afterwards show what exactly you have in your auto.master and auto.50004 files please. – HBruijn Jul 07 '14 at 14:06

3 Answers3

0

I'm getting the exact same behavior with the same configuration -- and nothing in /var/log/messages (good or bad) when I restart autofs.

mikehapner
  • 1,175
  • 10
  • 9
0

Proper /etc/auto.master line:

/var/www/html/resources   /etc/auto.50004

Proper /etc/auto.50004 content:

50004 -fstype=cifs,rw,user=user,pass=password,file_mode=0777,dir_mode=0777 ://server1/resources/50004
kubanczyk
  • 13,812
  • 5
  • 41
  • 55
0

Unfortunately, there are far too many guides on AutoFS which overly complicate autofs setup. Assuming you're on an Ubuntu box, here are the easy instructions on setting it up.

Here's some very simple instructions:

  • Install from apt-get: sudo apt-get install autofs -y
  • Remove everything in /etc/auto.master and replace with: /- /etc/auto.cifs --timeout=20 --ghost
  • Add one line like this to auto.cifs for each mount:/mnt/LOCAL/MOUNT/PATH -fstype=cifs,rw,noperm,credentials=/etc/auto.credentials ://SERVER/MOUNT
  • In /etc/auto.credentials, add the following content: username=USERNAME password=PASSWORD
  • Finally, sudo service autofs restart.

That's it.

George
  • 133
  • 6