Step 1: install fuse
root@tutorialspots / # sudo apt install fuse Reading package lists... Done Building dependency tree Reading state information... Done The following NEW packages will be installed: fuse 0 upgraded, 1 newly installed, 0 to remove and 51 not upgraded. Need to get 26.0 kB of archives. After this operation, 116 kB of additional disk space will be used. Get:1 http://archive.ubuntu.com/ubuntu focal/main amd64 fuse amd64 2.9.9-3 [26.0 kB] Fetched 26.0 kB in 0s (174 kB/s) Selecting previously unselected package fuse. (Reading database ... 110584 files and directories currently installed.) Preparing to unpack .../fuse_2.9.9-3_amd64.deb ... Unpacking fuse (2.9.9-3) ... Setting up fuse (2.9.9-3) ... update-initramfs: deferring update (trigger activated) Processing triggers for man-db (2.9.1-1) ... Processing triggers for initramfs-tools (0.136ubuntu6.7) ... update-initramfs: Generating /boot/initrd.img-5.15.0-124-generic I: The initramfs will attempt to resume from /dev/md0 I: (UUID=9d09856e-0eee-4bce-a3ac-c762418efd6c) I: Set the RESUME variable to override this.
Step 2: install rclone
root@tutorialspots / # sudo apt install rclone Reading package lists... Done Building dependency tree Reading state information... Done The following NEW packages will be installed: rclone 0 upgraded, 1 newly installed, 0 to remove and 51 not upgraded. Need to get 10.6 MB of archives. After this operation, 42.2 MB of additional disk space will be used. Get:1 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 rclone amd64 1.50.2-2ubuntu0.2 [10.6 MB] Fetched 10.6 MB in 1s (9,697 kB/s) Selecting previously unselected package rclone. (Reading database ... 110575 files and directories currently installed.) Preparing to unpack .../rclone_1.50.2-2ubuntu0.2_amd64.deb ... Unpacking rclone (1.50.2-2ubuntu0.2) ... Setting up rclone (1.50.2-2ubuntu0.2) ... Processing triggers for man-db (2.9.1-1) ...
Step 3: configuration rclone
root@tutorialspots / # rclone config 2024/11/11 11:47:06 NOTICE: Config file "/root/.config/rclone/rclone.conf" not found - using defaults No remotes found - make a new one n) New remote s) Set configuration password q) Quit config name> sb1 Type of storage to configure. Enter a string value. Press Enter for the default (""). Choose a number from below, or type in your own value 1 / 1Fichier \ "fichier" 2 / Alias for an existing remote \ "alias" 3 / Amazon Drive \ "amazon cloud drive" 4 / Amazon S3 Compliant Storage Provider (AWS, Alibaba, Ceph, Digital Ocean, Dreamhost, IBM COS, Minio, etc) \ "s3" 5 / Backblaze B2 \ "b2" 6 / Box \ "box" 7 / Cache a remote \ "cache" 8 / Citrix Sharefile \ "sharefile" 9 / Dropbox \ "dropbox" 10 / Encrypt/Decrypt a remote \ "crypt" 11 / FTP Connection \ "ftp" 12 / Google Cloud Storage (this is not Google Drive) \ "google cloud storage" 13 / Google Drive \ "drive" 14 / Google Photos \ "google photos" 15 / Hubic \ "hubic" 16 / JottaCloud \ "jottacloud" 17 / Koofr \ "koofr" 18 / Local Disk \ "local" 19 / Mail.ru Cloud \ "mailru" 20 / Microsoft Azure Blob Storage \ "azureblob" 21 / Microsoft OneDrive \ "onedrive" 22 / OpenDrive \ "opendrive" 23 / Openstack Swift (Rackspace Cloud Files, Memset Memstore, OVH) \ "swift" 24 / Pcloud \ "pcloud" 25 / Put.io \ "putio" 26 / SSH/SFTP Connection \ "sftp" 27 / Transparently chunk/split large files \ "chunker" 28 / Union merges the contents of several remotes \ "union" 29 / Webdav \ "webdav" 30 / Yandex Disk \ "yandex" 31 / http Connection \ "http" 32 / premiumize.me \ "premiumizeme" Storage> webdav ** See help for webdav backend at: https://rclone.org/webdav/ ** URL of http host to connect to Enter a string value. Press Enter for the default (""). Choose a number from below, or type in your own value 1 / Connect to example.com \ "https://example.com" url> https://u111111.your-storagebox.de Name of the Webdav site/service/software you are using Enter a string value. Press Enter for the default (""). Choose a number from below, or type in your own value 1 / Nextcloud \ "nextcloud" 2 / Owncloud \ "owncloud" 3 / Sharepoint \ "sharepoint" 4 / Other site/service or software \ "other" vendor> other User name Enter a string value. Press Enter for the default (""). user> u111111 Password. y) Yes type in my own password g) Generate random password n) No leave this optional password blank y/g/n> y Enter the password: password: Confirm the password: password: Bearer token instead of user/pass (eg a Macaroon) Enter a string value. Press Enter for the default (""). bearer_token> Edit advanced config? (y/n) y) Yes n) No y/n> y Command to run to get a bearer token Enter a string value. Press Enter for the default (""). bearer_token_command> Remote config -------------------- [sb1] url = https://u111111.your-storagebox.de vendor = other user = u111111 pass = *** ENCRYPTED *** -------------------- y) Yes this is OK e) Edit this remote d) Delete this remote y/e/d> y Current remotes: Name Type ==== ==== sb1 webdav e) Edit existing remote n) New remote d) Delete remote r) Rename remote c) Copy remote s) Set configuration password q) Quit config e/n/d/r/c/s/q> q
Step 4: Mount WebDAV:
mkdir /mount/path rclone mount remote_name:path/to/folder /mount/path
Example:
mkdir /mnt/sb1 rclone mount sb1:/ /mnt/sb1
Check:
ls -la /mnt/sb1
Ctrl+C
to stop rclone
Step 5: You can create a service
5.1: create file /etc/systemd/system/rclone-webdav.service
sudo nano /etc/systemd/system/rclone-webdav.service
With content:
[Unit] Description=Mount WebDAV with Rclone After=network-online.target [Service] Type=simple ExecStart=/usr/bin/rclone mount remote_name:path/to/folder /path/to/mount ExecStop=/usr/bin/fusermount -u /path/to/mount Restart=always User=your_username [Install] WantedBy=multi-user.target
Example with root
:
[Unit] Description=Mount WebDAV with Rclone After=network-online.target [Service] Type=simple ExecStart=/usr/bin/rclone mount sb1:/ /mnt/sb1 ExecStop=/usr/bin/fusermount -u /mnt/sb1 Restart=always User=root [Install] WantedBy=multi-user.target
Example with www-data
:
[Unit] Description=Mount WebDAV with Rclone After=network-online.target [Service] Type=simple ExecStart=sudo /usr/bin/rclone mount sb1:/ /mnt/sb1 ExecStop=sudo /usr/bin/fusermount -u /mnt/sb1 Restart=always User=www-data [Install] WantedBy=multi-user.target
Note: with www-data
you must do more steps:
a) sudo chown www-data:www-data /mnt/sb1
b) sudo visudo
add lines:
www-data ALL=(root) NOPASSWD: /usr/bin/rclone www-data ALL=(root) NOPASSWD: /usr/bin/fusermount
c) add sudo
before /usr/bin
in file /etc/systemd/system/rclone-webdav.service
5.2:
sudo systemctl enable rclone-webdav sudo systemctl start rclone-webdav