amtoaer

晓风残月

叹息似的渺茫,你仍要保存着那真!
github
telegram
email
x
bilibili
steam

Configure the Century Internet version of OneDrive to enable network shared folders

Background#

I have wanted a network shared folder for a long time, which can be used as a regular folder locally and accessed via the internet.

I roughly compared the services that could potentially achieve this functionality:

ServiceAdvantagesDisadvantages
Domestic cloud storage represented by Baidu CloudLarge storage spacePoor support for linux, slow access speed
Foreign cloud storage like google drive/megalinux client supportSmaller storage space, slow or even unreachable in China
Various oss services (e.g., Alibaba Cloud oss)Official mount support, unlimited speedAccumulated storage, traffic, and request costs, expensive
Idle storage space on serversAccessible via sftpLimited by server bandwidth, not ideal usage

As we can see, each service has its pros and cons. Recently, I discovered another product: Century Internet Version of OneDrive. It is operated by Microsoft through Century Internet in China. Compared to the international version of OneDrive, its data centers are located in Beijing/Shanghai, greatly optimizing access speed for domestic users. Additionally, there are many low-priced accounts available on Taobao, where you can buy "permanent" 5T storage space for fifty or sixty yuan (this is questionable). After searching online, I found that this Century Internet Version of OneDrive can be mounted locally using modified rclone, and accessed in the cloud using open-source projects like modified oneindex, zfile, etc. (without using server traffic, unlimited speed), perfectly meeting my needs, so I got one and prepared to get started.

Requirements#

  1. A personal computer
  2. A server
  3. An open API Century Internet Version of OneDrive account (must be open API!)

Cloud Side#

First, let's talk about the simple cloud access. I am using zfile (because it is easy to configure and natively supports Century Internet OneDrive).

The following operations are based on ubuntu, for centos please refer to the official documentation.

SSH into the server and first install the dependencies:

Download the project, unzip it, and give it executable permissions:

Start the project:

Next, access http://your_public_ip:8080/#/install for configuration. The access token and refresh token need to be obtained by logging in at this URL. After filling in successfully, click confirm to complete the configuration, and you can access your OneDrive cloud drive on the web!

Local#

Next, let's configure the slightly more complex local mount.

The following content is reproduced from znov's blog, as he mounted it on the server, while I am doing it on my local machine, so I made a few minor modifications. (Windows only needs to perform the first three steps, not tested).

  1. Obtain CLIENT_ID and CLIENT_SECRET for Century Internet OneDrive

    1. Open this webpage and log in.
    2. Find Azure Active Directory on the left and click it.
      Find App registrations on the left and click it.
      Find New registration at the top and click it.
      Name: onedrive
      Supported account types: Any organizational directory (the second option)
      Redirect URL: http://localhost:53682
      Click register.
      Find Application (client) ID and copy it for later use.
      Find Certificates & secrets on the left and click it.
      Below, Client secrets - New client secret
      Description: onedrive
      Expiration: default in one year
      Click Add, copy the Value for later use.
      Find API permissions on the left and click it.
      Add permissions: Microsoft Graph - Delegated permissions: check all (through my testing, checking only the File section is sufficient).
  2. Install and configure rclone

    1. Download here the rclone Century Internet version.

      This file comes from the global hosting forum, thanks to the great contributor. The original blog's download link is very slow, so I saved a copy. I hope everyone can also take a moment to comment and support the original blog!

    2. Open terminal in the current directory on linux and execute

      For windows, please refer to how to add files to the environment variable.

      Note: This step is not mandatory. If not executed, change rclone in the following commands to the path form of rclone.

    3. Enter rclone config to configure as follows

  3. Mounting

    linux needs to install fuse, which varies by distribution, so I won't elaborate. My manjaro comes with it.

    The command is as follows: (where / represents the path to mount onedrive locally, and /mnt/ represents the local mount path, which can be modified accordingly)

  4. Using the mount script

    This mount script can achieve basic mounting, unmounting, and remounting functions, so you won't need to enter such long commands afterward. The script is as follows:

    Assuming this script is saved as rcloned, first give it executable permissions:

    You can then choose to move it to the environment variable, manually execute rcloned start when using:

    You can also choose to set it to run automatically at boot like the original text (may not be supported by all distributions):

Screenshot#

image

Thoughts#

I originally planned to write a short article, but unexpectedly ended up writing so much...

Some steps in between are overly detailed, I hope you don't find me verbose while reading orz

References#

  1. zfile Official Documentation

  2. znov's Blog

  3. Zephyr Grocery Store (where I purchased the account)

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.