How to Mount OneDrive on CentOS Using Rclone

rclonemount onedrivecentoscloud storagelinux tutorial
Published·Modified·

Rclone is an excellent tool that can mount cloud storage services like OneDrive, Google Drive, and Amazon Drive. It supports all major platforms, allowing you to use it on Windows, macOS, and Linux. This article focuses on the process of mounting OneDrive on CentOS using Rclone; the principles and methods for other operating systems or cloud drives are largely similar.

Rclone Overview

Prerequisites

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

Install Rclone on Windows

After downloading, extract the file and move rclone.exe to the C:\Windows\System32 directory. This allows you to use the rclone command directly, as shown in the screenshot below.

Rclone Command

In the CMD window, enter the command rclone config to configure. Type n to create a new remote and give it a name, such as onedrive.

Create Remote

Proceed to the next step and select the cloud storage you wish to mount. OneDrive is option 16, though this may change with different versions, so adjust accordingly.

Select Cloud Storage

Leave client_id and client_secret blank and press Enter. Then select the OneDrive version: choose b for Education or Business versions, and p for Personal.

Select Version

The browser will automatically open http://localhost:53682/ to perform authorization. If successful, it will return a token. Be sure to record and save this token as it will be needed later.

Authorization Token

Token Saved

Install Rclone on CentOS

You can use the official one-click installation command:

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

Mount OneDrive on CentOS

The subsequent steps are identical to the Windows process, with one difference: when asked "Use auto config?", select n and enter the token you obtained earlier.

Enter Token

Continue by entering the following commands to mount the drive:

# Install fuse
yum -y install fuse
# Create mount directory
mkdir -p /home/onedrive
# Mount
rclone mount remote:path/to/files /home/onedrive
# To keep running in the background, use:
nohup rclone mount remote:path/to/files /home/onedrive &

Explanation of parameters:

  • remote: The remote name, which we set as onedrive.
  • path/to/files: The remote file path (OneDrive path), which can be set to /.
  • /home/onedrive: The local disk path.

If everything works correctly, you can verify the successful mount by entering df -h.

Verify Mount

Summary

Rclone supports mounting over 20 different cloud drives. While most are international services, they work best on foreign VPS servers and are excellent for data backup purposes.

Rclone Official Website: https://rclone.org/

Related Recommendations