Mounting OneDrive with Rclone on CentOS

Publish: 2018-05-18 | Modify: 2018-05-18

Rclone is a very powerful software that can mount cloud storage such as OneDrive, Google Drive, and Amazon Drive. It also supports all platforms, which means you can use it on Windows, Mac OS, and Linux. This article mainly shares the process of using Rclone to mount OneDrive on CentOS. The principles and methods for other systems or mounting other cloud drives are similar.

rclone

Prerequisite

Most CentOS servers do not have a graphical interface, but Rclone requires a computer with a built-in browser to complete the authorization process. Therefore, the method used here is to install Rclone on a local Windows computer and obtain the authorized token, then copy it to the CentOS server.

Install Rclone on Windows

  • Download the Windows client: rclone-v1.41-windows-amd64.zip
  • Extract the downloaded file and move rclone.exe to the C:\Windows\System32 directory, so that you can use the rclone command. See the screenshot below.

rclone

  • Open the command prompt and enter the command rclone config to start the configuration. Enter n to create a new remote and give it a name, such as onedrive. See the screenshot below.

rclone

  • Continue to the next step and select the cloud storage you want to mount. Onedrive is 16, but it may change with different versions. Be flexible and choose the appropriate number.

rclone

  • Leave client_id and client_secret empty and press Enter. Then select the OneDrive version. For education or business version, choose b; for personal version, choose p.

rclone

  • The browser will automatically open http://localhost:53682/ for authorization. If the authorization is successful, it will return a token. Be sure to record and save the token for later use.

rclone rclone

Install Rclone on CentOS

Simply use the official one-click installation command. Enter the following command:

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

Mount OneDrive on CentOS

The operation method is exactly the same as on Windows, so I won't repeat it. The only difference is to select n for "Use auto config?" and enter the previously obtained token.

rclone

Then enter the following command to mount:

# Install fuse
yum -y install fuse
# Create a mount directory
mkdir -p /home/onedrive
# Mount
rclone mount remote:path/to/files /home/onedrive
# If you need to keep it running in the background, use the following command
nohup rclone mount remote:path/to/files /home/onedrive &

Explanation of the parameters above:

  • remote: the name of the remote, which we set as onedrive before.
  • path/to/files: the remote file path (i.e., the Onedrive path), which can be set to /.
  • /home/onedrive: the local disk path.

If everything goes well, you can see that Onedrive is successfully mounted by entering df -h.

rclone

Summary

Rclone supports mounting more than 20 types of cloud drives, although most of them are foreign drives. It works better on foreign VPS for data backup and other purposes.


Comments