Install Gclone

Gclone is a modified Rclone made by downwa, it supports using SA accounts and automatically switches it if the daily quota is reached, you can also use the official Rclone. Here, I will use the Gclone as the demo.

bash <(wget -qO- https://git.io/gclone.sh)
## rename gclone to rclone
cp /usr/bin/gclone /usr/bin/rclone

Config Rclone

Connect Onedrive

rclone config

Type n and ENTER to create new config

Type your config name, eg: Onedrive

Choose 23 Microsoft OneDrive and press ENTER「When writing this tutorial, Onedrive is 23 options, please select according to the actual situation」

Acquire and use your own Client ID and Key

How to config Rclone with Microsoft Onedirve-1

If you don't need to use your own Client ID and Key,please press ENTER to bypass it, below is the step to get your own Client ID and Key

Open https://portal.azure.com/#blade/Microsoft_AAD_RegisteredApps/ApplicationsListBlade and click New registration

Give a name to the App and choose type Accounts in any organizational directory (Any Azure AD directory - Multitenant) and personal Microsoft accounts (e.g. Skype, Xbox)Redirect URI choose web and fill http://localhost:53682/ , the click register

How to config Rclone with Microsoft Onedirve-2

Copy and paste Application (client) ID to the command line and press ENTER

How to config Rclone with Microsoft Onedirve-3

Then choose Certificates & secrets on the left, then click New client secret ;Choose Never for the Expires then give it a description and click Add「In the latest interation, there is no more Never choice,you can just set a custom expire date you want」

How to config Rclone with Microsoft Onedirve-4

Copy and paste the Client secret/key,it will only show up once,create again if you forget it

How to config Rclone with Microsoft Onedirve-5

Then select API permissions on the left and click Add a permission ;Choose Microsoft Graph - delegated permissions

Search and add the following permissions: Files.Read, Files.ReadWrite, Files.Read.All, Files.ReadWrite.All, offline_access, User.Read. Check all of them and click Add permissions. After finished, it will look like below

How to config Rclone with Microsoft Onedirve-6

Paste the corresponding Client ID and secret you get above to the relevant step of Rclone

Back to the config process, type n and press ENTER to skip advanced settings

  • If you config Rclone on your local machine「which has a browser」:Choose y and press ENTER, it will open your default browser, login to your Microsoft account to authorize, if your browser doesn't open automatically, you can copy the address which showed up on the command window
  • If you config Rclone on your VPS「No GUI interface or browser」:Choose n and press ENTER,download Rclone to your local PC and extract it. In the Rclone folder, run the following command on the CMD terminal: rclone authorize "onedrive" -- "replace with your client id" "replace with your client secret" ,login your Microsoft account in the pop-up browser page

For example, On the Windows platform, you can type cmd on the Rclone folder address bar to run the command

How to config Rclone with Microsoft Onedirve-7

Copy entire content in the {} and paste it back to the corresponding Rclone config step


Then choose 1 and press ENTER, select OneDrive Personal or Business

Choose the drive which rclone find and type the corresponding number and press ENTER「Normally it shold be 0

Then choose y and press ENTER

Finally, type y to confirm all the information

Common command

# Upload VPS local file to the drive
rclone copy /local-file-path DestinationConfigName:/remote-path
# eg: rclone copy /root/storage/downloads Onedrive:/Temp -P

# Copy between two drives
rclone copy SourceConfigName:/source-file-path DestinationConfigName:/destination-file-path
# eg: rclone copy GoogleDrive:/Public Onedrive:/Temp -P --ignore-existing
  • Use --ignore-existing flag to ignore existing files
  • Use -P/ --progress flag to view real-time transfer statistics.
  • Use --dry-run flag to test without copying anything
  • --drive-server-side-across-configs flag allow Google Drive server-side copying
  • --onedrive-server-side-across-configs flag allow Onedrive server-side copying

It's highly recommended that you use --dry-run flag to test the command once before actually copying anything and read through the Rclone official docs. If you need to copy a large amount of files, use Tmux or Screen to keep it running in the background or it will stop transferring once you disconnect the SSH


Rclone Official wiki

Rclone config Microsoft OneDrive

Rclone config Google drive

Last modification:August 18, 2021
If you like my post, you can donate to buy me a cup of coffee.