mounting webdav as user (no sudo)
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).
Solution 1:
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.
Solution 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" \
[email protected]:/ $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
Solution 3:
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/