4

I'm trying to automount a sambashare as CIFS, as documented here: https://help.ubuntu.com/community/Autofs#CIFS

This seems so simple, I'm running out of things to google. It's probably something very obvious. Let me speak in commands:

sudo apt-get install autofs

sudo nano /etc/auto.master.d/myserver.autofs

files -fstype=cifs,rw ://server/files

sudo automount -f -v

Starting automounter version 5.0.7, master map /etc/auto.master
using kernel protocol version 5.02
syntax error in map near [ files -fstype=cifs,rw : ]
no mounts in table

I didn't do a whole lot, but I still did something wrong. How do I get this working?


edit @Jos

updated myserver.autofs:

/media/server/files -fstype=cifs,rw ://server/files

Output from sudo automount -f -v:

Starting automounter version 5.0.7, master map /etc/auto.master
using kernel protocol version 5.02
:
/
/
/
file map /etc/-fstype=cifs not found
mounted indirect on /media/server/files with timeout 300, freq 75 seconds
statemachine:1363: got unexpected signal 28!

Now we have a directory in /media! But it's empty.

Redsandro
  • 3,644
  • 6
  • 36
  • 46
  • post your other configuration files – Panther Nov 06 '15 at 13:13
  • 1
    Perhaps the mount point needs to contain the full path? (i.e. `/path/to/files -fstype=cifs,rw ://server/files`) – Jos Nov 06 '15 at 13:37
  • @bodhi.zazen such as? `auto.master` contains `+dir:/etc/auto.master.d` which is empty. – Redsandro Nov 06 '15 at 15:58
  • @Jos ok that seems to help, but I think the line is different from what was expected. It searches for the `-fstype` flag as if it's searching for a binary. I think the docs are outdated. – Redsandro Nov 06 '15 at 16:04
  • Hm. According to the most recent [man page](http://linux.die.net/man/5/autofs) it should be correct as stated. – Jos Nov 06 '15 at 16:12

2 Answers2

1

I was having a similar problem until I figured out reading a lot of pages. Try this:

  1. Make a sub-directory for automount in /media like /media/auto (I wanted to automount two different servers/files here and /media is available for other stuffs)

  2. Edit /etc/auto.master with:

    /media/auto /etc/auto.cifs-shares --timeout=500
    

    (You can give another name to file "auto.cifs-shares" and change timeout to another value if you want to)

  3. Create a file for store your config (as I wrote above I've written in /etc/auto.cifs-shares)

    files --fstype=cifs,credentials=/home/your_user/.credentials,dir_mode=0755,file_mode=0755,uid=your_user,rw ://server/files
    

    (if you don't give credentials it will automount as anonymous, it depends on permission)

  4. You have to restart service for having changes taking effect:

    service autofs restart
    
  5. That's it! Next try:

    ls /media/auto/files
    

(should give you what you want)

zx485
  • 2,249
  • 11
  • 24
  • 34
1

Try inserting a direct map line in "/etc/auto.master" - something like:

/-  /etc/auto.data

Where "/etc/auto.data" contains the "direct" mount point and your cifs mount info that you previously had in "myserver.autofs" - i.e.:

/media/server/files -fstype=cifs,rw ://server/files

I am new to autofs and was not able to get an "indirect" mapping working for a cifs mount but the above "direct" mapping method works for me.

mobile-boy
  • 11
  • 1