Auto Mount Webdav Folder

Auto Mount Webdav Folder

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;

  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

Here is an article about that automount . However I had a problem mounting it in that way, but when I commented the line secrets ~/.davfs2/secrets back everything went fine.

  • Install davfs2

    sudo apt-get install davfs2

  • Reconfigure davfs2 to enable to use davfs under unprivileged users

    sudo dpkg-reconfigure davfs2

  • Edit /etc/davfs2/davfs2.conf to enable automatic credentials use.

    • Uncomment the line secrets ~/.davfs2/secrets
  • Edit ~/.davfs2/secrets file to add credentials to remote WebDav diectory.

    • Add a line to the end of file in following style:

      URI> <username> <password>

    • Set the permission:

      chmod 600 ~/.davfs2/secrets

  • Add a line to /etc/fstab about the remote WebDav directory

    URI> <mount point> davfs user,noauto,file_mode=600,dir_mode=700 0 1

  • Add your user to the davfs2 group

    sudo vi /etc/group

    • Add your username as follows:

      davfs2:x:134:<username>

  • That's it. You can use following commands without being a root user to mount/umount

    mount <mount point>

    umount <mount point>

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

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Chloe Bennett
Author

Chloe Bennett

Chloe Bennett explores the intersection of pop culture, streaming entertainment, digital trends, and contemporary lifestyle. Her weekly commentary reaches thousands of culture enthusiasts.