So I have the problem that I have a WebDAV share that requires me to be logged into a VPN in order for it to be available. And in general, I have a lot of shares that I have access to but that aren't always available. So I have an assortment of shell scripts to create mount points and then mount the cifs share for me. I.e.
#!/bin/bash# CLI ARGSLONG_ARGS=unmount::SHORT_ARGS=u::OPTS=$(getopt -a -n weather --options $SHORT_ARGS --longoptions $LONG_ARGS -- "$@")eval set -- "$OPTS"mount=truewhile : do case "$1" in -u | --unmount ) mount=false echo "Unmounting and removing Folder" shift 2; ;; -- ) shift; break ;; * ) echo "Unexpected option $1" exit 2 ;; esacdoneif $mountthen sudo mkdir /mnt/some-mount sudo mount -t cifs -o username=uname,password=password //1.1.1.1/remote-mount /mnt/some-mount -o rw,uid=1000,gid=1000else sudo umount /mnt/some-mount sudo rm -rf /mnt/some-mountfiecho "Done"
I've tried and tinkered around with the options of davfs
. I was unable to get it to automate correctly. Adding the WebDAV share to the /etc/fstab
works and adding the login to the /etc/davfs/secrets
.
I read in the docs of davfs2
that you can have a config in ~/.davfs2
but sudo mount /mnt/webdav-share
with /mnt/webdav-share
in the personal config doesn't work and mount complains that there's no entry in /etc/fstab
for that mount point.