6

With FUSE it is possible to mount many things purely as a non privileged user. However, it seems that for webdav davfs2 is the preferred project, which appears to be a filesystem driver and uses the standard mount/umount which requires privileges.

Is there a way to use this (or another library) to mount webdav only as a user via fuse ? (i.e. so each user could mount a different webdav on a different server, without needing to configure anything in fstab etc).

Michael Neale
  • 3,654
  • 5
  • 27
  • 26

3 Answers3

6

I was able to use wdfs to make it work as a non priv. user:

 wdfs <dav url> <mount point>

To unmount

fusermount -u <mount point>

wdfs is from here and uses fuse. I use Archlinux and this AUR package worked fine.

But current state of wdfs is unclear, there is a kind-of-fork lurking at gihub as well.

Felix
  • 119
  • 5
Michael Neale
  • 3,654
  • 5
  • 27
  • 26
2

As a starter answer.. I would suggest the following.

1) sshfs doesn't require access to the /etc/fstab, so if you can map your webdav users onto linux users with similar file structure, then that is a simple alternative.

Then you can use non-root syntax like this to mount within your local home directory;

sshfs -o ControlPath=none -o workaround=rename -o idmap=user \
-o nonempty -o reconnect -o transform_symlinks -o follow_symlinks"   \
userXXX@my.ssh.server.com:/ $HOME/mnt/my.ssh.server.com

2) gvfs/gio - Depending on your distro, /usr/libexec/gvfsd-dav might be an option, which should allow an alternative control syntax to mount the webdav filesystem under ~/.gvfs/

However the documentation is pretty rubbish, and I've only made a limited test of its functionality like so;

As root;

sudo yum install gvfs-fuse.x86_64

then as a user;

$ gvfs-mount dav://my.dav.server.hostname.com/projects/
Enter password for Authorization Realm
User: my.dav.username
Password: XXXXXX

$ cd ~/.gvfs/WebDAV\ on\ my.dav.server.hostname.com/

$ ls 
proj1
proj2
proj3
...
etc
Tom
  • 10,886
  • 5
  • 39
  • 62
  • yes, the sshfs looks great - for ssh, it almost seems as if it was a step backwards for davfs2 to use regular mounting (but it does make it easy when you don't want to do it in user space - just another file system) – Michael Neale May 23 '12 at 08:52
  • hmm. I am having trouble getting a gvfs to mount a webdav on my headless CentOS test box... `sudo yum install gvfs-fuse.x86_64` and then `gvfs-mount dav://my.dav.server.hostname.com/projects/` is giving `Error mounting location: volume doesn't implement mount` – Tom May 23 '12 at 08:58
  • but it works fine in userspace on my local fedora, maybe its missing some library that implements that userspace mount option – Tom May 23 '12 at 08:59
  • yes I am using Arch linux, and see the same - "doesn't implement mount". gvfs does seem "shady" - a lot of dependencies came with it. davfs2 seems the appropriate way and works well, but alas is not user space purely. Oh well. If you find any more out, please make a note here ! – Michael Neale May 23 '12 at 22:49
  • I was able to execute this command like this: `gvfs-mount davs://@` after doing it once in Nautilus with checking 'store password'. Now Nautilus shows the contents properly after this mount command. But where on earth is is mounted in the file system?? I expected sth below `~/.gvfs/` or similar, but nothing shows. – Alfe Nov 30 '15 at 10:36
  • As far as I see it, it will still rely on your applications being able to speak webdav (libreoffice does, but its no fun). Having it mounted via mount.davfs made the thing much more usable for me (in a desktop environment). – Felix Jun 06 '18 at 10:33
2

If you have sudo rights but want to mount this the directory as a regular user you can use davfs and mount. Just adding this for completion if somebody searches for this answer like I did.

sudo apt-get install davfs2

mkdir myDir

sudo mount -t davfs -o uid=myUser -o gid=myUser https://example.org/remote.php/webdav/ /home/myUser/myDir/
select
  • 121
  • 3