NextCloud and rclone

From Master of Neuroscience Wiki

How to install rclone

sudo apt install rclone

rclone config

rclone config
No remotes found, make a new one?
n) New remote
s) Set configuration password
q) Quit config
n/s/q> n
Enter name for new remote.
name> UB
Option Storage.
Type of storage to configure.
Choose a number from below, or type in your own value.
 1 / 1Fichier
   \ (fichier)
 2 / Akamai NetStorage
   \ (netstorage)
 3 / Alias for an existing remote
   \ (alias)
 4 / Amazon Drive
   \ (amazon cloud drive)
 5 / Amazon S3 Compliant Storage Providers including AWS, Alibaba, Ceph, China Mobile, Cloudflare, ArvanCloud, Digital Ocean, Dreamhost, Huawei OBS, IBM COS, IDrive e2, IONOS Cloud, Lyve Cloud, Minio, Netease, RackCorp, Scaleway, SeaweedFS, StackPath, Storj, Tencent COS, Qiniu and Wasabi
   \ (s3)
 6 / Backblaze B2
   \ (b2)
 7 / Better checksums for other remotes
   \ (hasher)
 8 / Box
   \ (box)
 9 / Cache a remote
   \ (cache)
10 / Citrix Sharefile
   \ (sharefile)
11 / Combine several remotes into one
   \ (combine)
12 / Compress a remote
   \ (compress)
13 / Dropbox
   \ (dropbox)
14 / Encrypt/Decrypt a remote
   \ (crypt)
15 / Enterprise File Fabric
   \ (filefabric)
16 / FTP
   \ (ftp)
17 / Google Cloud Storage (this is not Google Drive)
   \ (google cloud storage)
18 / Google Drive
   \ (drive)
19 / Google Photos
   \ (google photos)
20 / HTTP
   \ (http)
21 / Hadoop distributed file system
   \ (hdfs)
22 / HiDrive
   \ (hidrive)
23 / In memory object storage system.
   \ (memory)
24 / Internet Archive
   \ (internetarchive)
25 / Jottacloud
   \ (jottacloud)
26 / Koofr, Digi Storage and other Koofr-compatible storage providers
   \ (koofr)
27 / Local Disk
   \ (local)
28 / Mail.ru Cloud
   \ (mailru)
29 / Microsoft Azure Blob Storage
   \ (azureblob)
30 / Microsoft OneDrive
   \ (onedrive)
31 / OpenDrive
   \ (opendrive)
32 / OpenStack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
   \ (swift)
33 / Pcloud
   \ (pcloud)
34 / Put.io
   \ (putio)
35 / SMB / CIFS
   \ (smb)
36 / SSH/SFTP
   \ (sftp)
37 / Sia Decentralized Cloud
   \ (sia)
38 / Sugarsync
   \ (sugarsync)
39 / Transparently chunk/split large files
   \ (chunker)
40 / Union merges the contents of several upstream fs
   \ (union)
41 / Uptobox
   \ (uptobox)
42 / WebDAV
   \ (webdav)
43 / Yandex Disk
   \ (yandex)
44 / Zoho
   \ (zoho)
45 / premiumize.me
   \ (premiumizeme)
46 / seafile
   \ (seafile)
Storage> 42

Here we need your nextcloude webdav credentials:

With your normal browser goto https://nc.uni-bremen.de/index.php/settings/user/security -

Add a new name for the connection e.g. rclone and press [Neues App Passwort erstellen]

Remember the user and password

Here you need to use your username (with the @uni-bremen.de)

Option url.
URL of http host to connect to.
E.g. https://example.com.
Enter a value.
url> https://nc.uni-bremen.de/remote.php/dav/files/davrot@uni-bremen.de/
Option vendor.
Name of the WebDAV site/service/software you are using.
Choose a number from below, or type in your own value.
Press Enter to leave empty.
 1 / Nextcloud
   \ (nextcloud)
 2 / Owncloud
   \ (owncloud)
 3 / Sharepoint Online, authenticated by Microsoft account
   \ (sharepoint)
 4 / Sharepoint with NTLM authentication, usually self-hosted or on-premises
   \ (sharepoint-ntlm)
 5 / Other site/service or software
   \ (other)
vendor> 1

Here you need to use your username (with the @uni-bremen.de)

Option user.
User name.
In case NTLM authentication is used, the username should be in the format 'Domain\User'.
Enter a value. Press Enter to leave empty.
user> davrot@uni-bremen.de

Use the password, nextcloud gave you:

Option pass.
Password.
Choose an alternative below. Press Enter for the default (n).
y) Yes, type in my own password
g) Generate random password
n) No, leave this optional password blank (default)
y/g/n> y
Enter the password:
password:
Confirm the password:
password:
Option bearer_token.
Bearer token instead of user/pass (e.g. a Macaroon).
Enter a value. Press Enter to leave empty.
bearer_token>
Edit advanced config?
y) Yes
n) No (default)
y/n> n
Configuration complete.
Options:
- type: webdav
- url: https://nc.uni-bremen.de/remote.php/dav/files/davrot@uni-bremen.de/
- vendor: nextcloud
- user: davrot@uni-bremen.de
- pass: *** ENCRYPTED ***
Keep this "UB" remote?
y) Yes this is OK (default)
e) Edit this remote
d) Delete this remote
y/e/d> y
Current remotes:

Name                 Type
====                 ====
UB                   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

lsd

Show your directories

davrot@tea: /home/davrot/test_rclone
> rclone lsd UB:
[...]
          -1 2023-10-10 17:49:51        -1 klaus_ytong
          -1 2024-01-03 21:02:58        -1 neurotec
          -1 2026-04-08 11:40:00        -1 overleaf_nc1
[...]

copy

copy NextCloud to local folder

> rclone copy UB:klaus_ytong ./klaus_ytong --progress
Transferred:        1.453 GiB / 1.453 GiB, 100%, 52.017 MiB/s, ETA 0s
Transferred:            4 / 4, 100%
Elapsed time:        25.6s

Copy local folder to NextCloud

> rclone copy ./klaus_ytong UB:klaus_ytong_backup --progress
Transferred:        1.453 GiB / 1.453 GiB, 100%, 61.433 MiB/s, ETA 0s
Transferred:            4 / 4, 100%
Elapsed time:        28.0s
davrot@tea: /home/davrot/test_rclone

Other commands

https://rclone.org/docs/#basic-syntax