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,764

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,865
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.