7

I want to auto mount webdav folder with bash script. My server resources very pool so I have a memory problem about webdav. Therefore, I have to umount webdav folder for clear cache and memory. But, I have to manuel mount webdav folders, after than umount command. Because, system ask to me credentail for webdav folder so, I can't do it with bash script.

I edit ~/.davfs/secret file as following format;

 http://address username password

after than, I uncomment line secrets ~/.davfs2/secret in /etc/davfs2/davfs2.conf file.

But, system still ask to me credential information.

How can I auto mount webdav ?

Thanks

1 Answer 1

10

Here is an article about that automount https://techiech.blogspot.ch/2013/04/mounting-webdav-directory-in-linux.html.

  • Create a folder to mount sudo mkdir /mnt/dav/
  • Install davfs2 sudo apt install davfs2
  • Reconfigure it to allow use for unprivileged users sudo dpkg-reconfigure davfs2
  • Edit ~/.davfs2/secrets file to add credentials to remote WebDAV directory.
    • Add a line to the end of file in following style: https://<WebDav URI> <username> <password>
    • Set the permission: chmod 600 ~/.davfs2/secrets
  • Add a line to /etc/fstab like https://<WebDav URI> /mnt/dav/ davfs user,noauto,file_mode=600,dir_mode=700 0 1
  • Reload systemd systemctl daemon-reload
  • Add your user to the davfs2 group sudo usermod -a -G davfs2 your_user
  • Then logout and login again
  • That's it. You can use following commands without being a root user to mount with mount /mnt/dav/

You can also use nautilus to mount/unmount the directory.

2
  • Cool, this helped me, but can I also automount this folder at boot?
    – Tominator
    Jan 30, 2019 at 10:48
  • 1
    On Ubuntu 20.04 I had to: 1. copy /etc/davfs2/davfs2.conf to ~/.davfs2 and then edit that file instead (ie uncomment secret...) 2. reboot after adding user to davfs2 group.
    – hamx0r
    Jun 5, 2020 at 20:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .