4

I am trying to mount a webdav server in /etc/fstab with davfs, but when i try open this in my file manager (Thunar) i will get the error:

Failed to mount "My Folder"

/sbin/mount.davfs: different URL in /etc/fstab

The entry in /etc/fstab looks like this:

http://<server_url>/my/path/Doe\054\040John/  /home/john/My\040Folder       davfs   user,noauto     0       0

But i am still able to mount it successfully with:

sudo mount -t davfs http://<server-url>/my/path/Doe,\ John/ /home/john/My\ Folder

Any ideas what am i doing wrong in /etc/fstab?

Thanks for your help!

nichtNox
  • 582

2 Answers2

2

TL;DR aka the fun part:

In the /etc/fstab file, you should NOT escape the comma character while spaces and tabs must be escaped using zero-padded octal numbers preceded by backslash \ as it stated in fstab's man page. In your case, the URL string should look like this:

http://<server_url>/my/path/Doe,\040John/

The boring part:

First of all, you should take a look at this one: https://superuser.com/a/527503/938480

I'll cite the last sentence of the post above here which is essential for the answer in my opinion:

Note that, while code points are supported for other characters as well, the support is rather flaky. On my machine, you can write \127 instead of W, but not \070 instead of 8...

And the davfs2 man states:

URLS AND MOUNT POINTS WITH SPACES Special characters like spaces in pathnames are a mess. They are interpreted differently by different programs and protocols, and there are different rules for escaping. In fstab spaces must be replaced by a three digit octal escape sequence. Write http://foo.bar/path\040with\040spaces instead of http://foo.bar/path with spaces. For the davfs2.conf and the secrets files please see the escape and quotation rules described in the davfs2.conf(5) man page. On command line you must obey the escaping rules of the shell.

And finally let's look at the fstab manual itself:

The second field (fs_file). This field describes the mount point for the filesystem. For swap partitions, this field should be specified as 'none'. If the name of the mount point contains spaces these can be escaped as '\040'

As we can see above, there is actually no mentioning of anything but spaces and tabs.

I've tested the issue with one of the free online Nextcloud instances (Nextcloud natively comes with a built-in WevDAV support) and I got the same error using the same folder name as in your example Doe, John and the same escaping sequence \054\040. Then I removed escaping of the comma and it mounted ok.

folivore
  • 161
1

Too few information to give a hint on whats going wrong here - but after installing davfs2 my working fstab entry looks like this:

https://my-owncloud-url/remote.php/webdav  /media/owncloud/ davfs user,noauto,rw,_netdev 0 0

works very well... just after changing the content of the fstab you can check if it is working by entering

sudo mount -a

or by entering

sudo mount mountpoint-here

but keep in mind - the folder has to exist before mount can be initialized...

Mr.Gosh
  • 463