Skip to content

Instantly share code, notes, and snippets.

@vijinho
Last active July 22, 2024 19:26
Show Gist options
  • Save vijinho/78019b6b0ce5dd3529ffd2fddf8bbabf to your computer and use it in GitHub Desktop.
Save vijinho/78019b6b0ce5dd3529ffd2fddf8bbabf to your computer and use it in GitHub Desktop.
Simple dav server using rclone with a htpasswd file, specify port and data dir, designed for home network usage only. e.g. dav.sh 8080 /mnt/data/joplin - serves webdav using .htpasswd file in folder joplin - can be run from crontab using @reboot
# ./dav.sh 8090 /mnt/data/joplin
PORT=$1
DATA_DIR=$2
NAME=`basename $DATA_DIR`
CACHE_DIR=/var/cache/dav/$NAME
#rm -fR $CACHE_DIR
mkdir -p $CACHE_DIR
chmod -fR 777 $CACHE_DIR
/home/linuxbrew/.linuxbrew/bin/rclone serve webdav --htpasswd $DATA_DIR/.htpasswd --addr :$PORT $DATA_DIR --buffer-size 512M --dir-cache-time 15m --cache-dir $CACHE_DIR --vfs-cache-mode full --vfs-cache-max-size 4G --no-checksum --vfs-case-insensitive --vfs-disk-space-total-size 4G 2>&1 > /var/log/rclone.log &
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment