Installdavfs2package to mount WebDAV resource as regular file system.
$ sudo apt-get install davfs2
Mount WebDAV share using command-line
Create the mountpoint directory.
$ sudo mkdir /mnt/dav
Usemountcommand to mount theWebDAVshare.
$ sudo mount -t davfs -o noexec https://nextcloud.example.com/remote.php/webdav/ /mnt/dav/
Please enter the username to authenticate with server
https://nextcloud.example.com/remote.php/webdav/ or hit enter for none.
Username: milo
Please enter the password to authenticate user milosz with server
https://nextcloud.example.com/remote.php/webdav/ or hit enter for none.
Password:
/sbin/mount.davfs: warning: the server does not support lock
Useumountcommand to unmount theWebDAVshare.
$ sudo umount /mnt/dav
/sbin/umount.davfs: waiting while mount.davfs (pid 1475) synchronizes the cache .. OK
Mount WebDAV share using fstab
Createfstabentry to allow the specified user to mount the filesystem.
$ cat << EOF | sudo tee -a /etc/fstab
# personal webdav
https://nextcloud.example.com/remote.php/webdav/ /mnt/dav davfs _netdev,noauto,user,uid=milosz,gid=milosz 0 0
EOF
Storeusernameandpasswordfor the remoteWebDAVshare.
$ cat << EOF | sudo tee -a /etc/davfs2/secrets
# personal webdav, nextcloud application password
/mnt/dav milosz mypassword
# older versions used URL, it is equivalent for compatibility reasons
#https://nextcloud.example.com/remote.php/webdav/ milosz mypassword
EOF
You can mount the above-mentionedWebDAVshare usingsudoutility.
$ sudo mount /mnt/dav
Additional notes
If you try to mount it as regular user and encounter the following error, then you need to set SUID bit on the mount.davfs binary.
$ mount /mnt/dav
/sbin/mount.davfs: program is not setuid root
Execute dpkg-reconfigure to reconfigure davfs2 package, set the SUID bit and allow unprivileged users to mount WebDAV resources.
$ sudo dpkg-reconfigure davfs2
Reconfigure davfs2 package
In addition, user must be a member of the davfs2 group.
$ mount /mnt/dav
/sbin/mount.davfs: user milosz must be member of group davfs2
Use the following command to add specified user to required group.
Sem comentários:
Enviar um comentário