banner
年糕

年糕日记

此站为备份站点,最新文章请访问 oior.net
telegram
email

Rclone Installation and Configuration Tutorial - Connecting to OneDrive

Preface#

Rclone is a command-line tool that supports syncing, uploading, and downloading data between different object storage and cloud storage services. It also offers practical features such as offline downloading and server backup through various settings. In this example, we will configure the connection with OneDrive and Google Drive, but the operations for other cloud storage services are similar. Since it is an interactive configuration option, there is no difficulty as long as you can understand the basics.

Installing Rclone#

The official provides a one-click installation script:

curl https://rclone.org/install.sh | sudo bash

Connecting OneDrive with Rclone#

Obtaining a token#

Download Rclone on your local Windows computer from here, then extract it and enter the folder. In the file explorer's address bar, type cmd and press enter to open the command prompt in the current path. Enter the following command:

rclone authorize "onedrive"

A browser window will pop up and ask you to log in to your account for authorization. After authorization, the command prompt window will display the following information:

If your browser doesn't open automatically go to the following link: http://127.0.0.1:53682/auth
Log in and authorize rclone for access
Waiting for code...
Got code
Paste the following into your remote machine --->
{"access_token":"xxxxxxxx"}  # Note! Copy the entire content of {xxxxxxxx} and save it, as it will be needed later
<---End paste

Configuring Rclone#

Enter the command rclone config, and the following information will appear. Follow the comments below to perform the operations.

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> n  # Select n to create a new remote
name> P3TERX   # Enter a name, similar to a label used to distinguish different cloud storage services.
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 / A stackable unification remote, which can appear to merge the contents of several remotes
   \ "union"
 2 / Alias for a existing remote
   \ "alias"
 3 / Amazon Drive
   \ "amazon cloud drive"
 4 / Amazon S3 Compliant Storage Providers (AWS, Ceph, Dreamhost, IBM COS, Minio)
   \ "s3"
 5 / Backblaze B2
   \ "b2"
 6 / Box
   \ "box"
 7 / Cache a remote
   \ "cache"
 8 / Dropbox
   \ "dropbox"
 9 / Encrypt/Decrypt a remote
   \ "crypt"
10 / FTP Connection
   \ "ftp"
11 / Google Cloud Storage (this is not Google Drive)
   \ "google cloud storage"
12 / Google Drive
   \ "drive"
13 / Hubic
   \ "hubic"
14 / JottaCloud
   \ "jottacloud"
15 / Local Disk
   \ "local"
16 / Mega
   \ "mega"
17 / Microsoft Azure Blob Storage
   \ "azureblob"
18 / Microsoft OneDrive
   \ "onedrive"
19 / OpenDrive
   \ "opendrive"
20 / Openstack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
   \ "swift"
21 / Pcloud
   \ "pcloud"
22 / QingCloud Object Storage
   \ "qingstor"
23 / SSH/SFTP Connection
   \ "sftp"
24 / Webdav
   \ "webdav"
25 / Yandex Disk
   \ "yandex"
26 / http Connection
   \ "http"
Storage> 18  # Select 18 for Microsoft OneDrive
** See help for onedrive backend at: https://rclone.org/onedrive/ **

Microsoft App Client Id
Leave blank normally.
Enter a string value. Press Enter for the default ("").
client_id>   # Leave it blank, press enter
Microsoft App Client Secret
Leave blank normally.
Enter a string value. Press Enter for the default ("").
client_secret>   # Leave it blank, press enter
Edit advanced config? (y/n)
y) Yes
n) No
y/n> n  # Select n
Remote config
Use auto config?
 * Say Y if not sure
 * Say N if you are working on a remote or headless machine
y) Yes
n) No
y/n> n  # Select n
For this to work, you will need rclone available on a machine that has a web browser available.
Execute the following on your machine:
    rclone authorize "onedrive"
Then paste the result below:
result> {"XXXXXXXX"}  # Paste the token saved above here
2018/10/31 19:54:06 ERROR : Failed to save new token in config file: section 'P3TERX' not found
Choose a number from below, or type in an existing value
 1 / OneDrive Personal or Business
   \ "onedrive"
 2 / Root Sharepoint site
   \ "sharepoint"
 3 / Type in driveID
   \ "driveid"
 4 / Type in SiteID
   \ "siteid"
 5 / Search a Sharepoint site
   \ "search"
Your choice> 1  # Here it asks you to choose the type, select 1
Found 1 drives, please select the one you want to use:
0: OneDrive (business)
Chose drive to use:> 0  # The program found the cloud storage, and the number here is 0, so select 0
Found drive 'root' of type 'business', URL: https://xxxxxx-my.sharepoint.com/personal/xxxxxxx/Documents
Is that okay?
y) Yes
n) No
y/n> y  # Select y
--------------------
[P3TERX]
type = onedrive
token = {"XXXXXXXX"}
drive_id = XXXXXXXXX
drive_type = business
--------------------
y) Yes this is OK
e) Edit this remote
d) Delete this remote
y/e/d> y  # Select y
Current remotes:

Name                 Type
====                 ====
P3TERX               onedrive

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  # Select q to exit
Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.