11

I'm trying to make a WebDAV auto-mount on my machine.

I've installed davfs2, then copied /etc/davfs2 to ~/.davfs2. I added the WebDAV URL to /etc/fstab:

[URL of the WebDAV]   [Local folder]    davfs   rw,user,auto    0   0

I also added the username and password to ~/.davfs2/secrets and uncommented secrets ~/.davfs2/secrets in ~/.davfs2/davfs2.conf to enable automatic login.

Now I can manually mount it by running mount www.myserver.com (it doesn't ask me for username/password). I understand that running mount -a will do the same thing that would've been done at boot, but when I run sudo mount -a as my user (just mount -a says I need to be root) I do get asked for a username/password.

I then uncommented secrets ~/.davfs2/secrets in /etc/davfs2/davfs2.conf to enable automatic authentication (see this and this). Now running sudo mount -a AND just using mount both result in /sbin/mount.davfs:/etc/davfs2/davfs2.conf:36: unknown option. Line 36 is the secrets ~/.davfs2/secrets line.

Why does it say unknown option? How do I fix it?

Superbest
  • 487
  • 2
  • 5
  • 15
  • One problem I had: When using the conf= option for `mount -o` the davfs.conf file needs to be given as parameter (with an absolute path to the secrets file!), not the secrets file itself. – sebix Aug 18 '19 at 07:41

3 Answers3

9

I have just sorted this out on a linux (mint 17.3) laptop.

There were two things contributing to my problem:

  1. I had enabled ordinary users to use davfs. Leave the secrets line in /etc/davfs2/davfs2.conf commented out. This will force davfs to rely on the user specific configuration. I had both the global (/etc/davfs2/) and user (~/.davfs2/) configuration files both trying to do the job at the same time.

    1(a). you may need to uncomment the secrets line in ~/.davfs2/davfs2.conf. Mine is uncommented and works, but the default may work fine too. I have not tested it.

  2. in ~/davfs2/cache/ the directory for my remote webdav connection cache had incorrect permissions - it needs to be set to 0700 (not just 700).

Donn Lee
  • 105
  • 3
Tim Chambers
  • 91
  • 1
  • 1
  • 10
    The 'secrets' line is not allowed in /etc/davfs2/davfs2.conf, and this is why the error "unknown option" is thrown. The 'secrets' line is allowed in *user* config files like ~/.davfs2/davfs2.conf. Just copy the stock /etc/davfs2/davfs2.conf file to ~/.davfs2/ and uncomment the `secrets` line in ~/.davfs2/davfs2.conf . – Donn Lee Oct 04 '16 at 06:28
4

I had the same problem when I named the file ~/.davfs2/secret instead of ~/.davfs2/secrets. I fixed this and now it works.

It seems that the error message is misleading, there's nothing wrong with the option.

Kevdog777
  • 3,194
  • 18
  • 43
  • 64
Lercherl
  • 41
  • 2
0

The correct file permission for secrets is 600, execute the command chmod 600 secrets.

Greenonline
  • 1,759
  • 7
  • 16
  • 21