1. Windows下载rclone

下载链接

1.2 获取access_token并保存

./rclone.exe authorize "onedrive"

image-1660176353765
image-1660176508522

2. vps安装rclone

对于amd64(x86_64)

wget https://downloads.rclone.org/v1.59.1/rclone-v1.59.1-linux-amd64.deb && dpkg -i rclone-v1.59.1-linux-amd64.deb

对于arm64

wget https://downloads.rclone.org/v1.59.1/rclone-v1.59.1-linux-arm64.deb && dpkg -i rclone-v1.59.1-linux-arm64.deb

3. 配置rclone

rclone config

出现1:

No remotes found, make a new one?
n) New remote
s) Set configuration password
q) Quit config
n/s/q> n          ##←←←←←输入n

出现2:

Enter name for new remote.
name> od     #←←←←随便写

出现3:

Option Storage.
Type of storage to configure.
Choose a number from below, or type in your own value.
 1 / 1Fichier
   \ (fichier)
 2 / Akamai NetStorage
   \ (netstorage)
 3 / Alias for an existing remote
   \ (alias)
 4 / Amazon Drive
   \ (amazon cloud drive)
 5 / Amazon S3 Compliant Storage Providers including AWS, Alibaba, Ceph, China Mobile, Cloudflare, ArvanCloud, Digital Ocean, Dreamhost, Huawei OBS, IBM COS, IDrive e2, Lyve Cloud, Minio, Netease, RackCorp, Scaleway, SeaweedFS, StackPath, Storj, Tencent COS and Wasabi
   \ (s3)
 6 / Backblaze B2
   \ (b2)
 7 / Better checksums for other remotes
   \ (hasher)
 8 / Box
   \ (box)
 9 / Cache a remote
   \ (cache)
10 / Citrix Sharefile
   \ (sharefile)
11 / Combine several remotes into one
   \ (combine)
12 / Compress a remote
   \ (compress)
13 / Dropbox
   \ (dropbox)
14 / Encrypt/Decrypt a remote
   \ (crypt)
15 / Enterprise File Fabric
   \ (filefabric)
16 / FTP
   \ (ftp)
17 / Google Cloud Storage (this is not Google Drive)
   \ (google cloud storage)
18 / Google Drive
   \ (drive)
19 / Google Photos
   \ (google photos)
20 / HTTP
   \ (http)
21 / Hadoop distributed file system
   \ (hdfs)
22 / HiDrive
   \ (hidrive)
23 / Hubic
   \ (hubic)
24 / In memory object storage system.
   \ (memory)
25 / Internet Archive
   \ (internetarchive)
26 / Jottacloud
   \ (jottacloud)
27 / Koofr, Digi Storage and other Koofr-compatible storage providers
   \ (koofr)
28 / Local Disk
   \ (local)
29 / Mail.ru Cloud
   \ (mailru)
30 / Mega
   \ (mega)
31 / Microsoft Azure Blob Storage
   \ (azureblob)
32 / Microsoft OneDrive
   \ (onedrive)
33 / OpenDrive
   \ (opendrive)
34 / OpenStack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
   \ (swift)
35 / Pcloud
   \ (pcloud)
36 / Put.io
   \ (putio)
37 / QingCloud Object Storage
   \ (qingstor)
38 / SSH/SFTP
   \ (sftp)
39 / Sia Decentralized Cloud
   \ (sia)
40 / Storj Decentralized Cloud Storage
   \ (storj)
41 / Sugarsync
   \ (sugarsync)
42 / Transparently chunk/split large files
   \ (chunker)
43 / Union merges the contents of several upstream fs
   \ (union)
44 / Uptobox
   \ (uptobox)
45 / WebDAV
   \ (webdav)
46 / Yandex Disk
   \ (yandex)
47 / Zoho
   \ (zoho)
48 / premiumize.me
   \ (premiumizeme)
49 / seafile
   \ (seafile)
Storage>32    ##←←←←←输入32以自己显示的为准

出现4:
直接回车

Option client_id.
OAuth Client Id.
Leave blank normally.
Enter a value. Press Enter to leave empty.
client_id>      ##直接回车

出现5:
直接回车

Option client_secret.
OAuth Client Secret.
Leave blank normally.
Enter a value. Press Enter to leave empty.
client_secret>   ##直接回车

出现6:

Option region.
Choose national cloud region for OneDrive.
Choose a number from below, or type in your own string value.
Press Enter for the default (global).
 1 / Microsoft Cloud Global           #国际版OneDrive一般选这个
   \ (global)
 2 / Microsoft Cloud for US Government  #美国版OneDrive
   \ (us)
 3 / Microsoft Cloud Germany   #德国版OneDrive
   \ (de)
 4 / Azure and Office 365 operated by 21Vianet in China     #世纪互联
   \ (cn)
region>1            #←←←←←选1

出现7:

Edit advanced config?
y) Yes
n) No (default)
y/n> n          #←←←←←选n

出现8:
翻译:是否使用自动配置

Use auto config?
 * Say Y if not sure
 * Say N if you are working on a remote or headless machine

y) Yes (default)
n) No
y/n> n    #←←←←←选n

出现9:

Option config_token.
For this to work, you will need rclone available on a machine that has
a web browser available.
For more help and alternate methods see: https://rclone.org/remote_setup/
Execute the following on the machine with the web browser (same rclone
version recommended):
        rclone authorize "onedrive"
Then paste the result.
Enter a value.
config_token> {"access_token":"xxxxxxxx"}    #←←粘贴ccess_token

出现10:

Option config_type.
Type of connection
Choose a number from below, or type in an existing string value.
Press Enter for the default (onedrive).
 1 / OneDrive Personal or Business
   \ (onedrive)
 2 / Root Sharepoint site
   \ (sharepoint)
   / Sharepoint site name or URL
 3 | E.g. mysite or https://contoso.sharepoint.com/sites/mysite
   \ (url)
 4 / Search for a Sharepoint site
   \ (search)
 5 / Type in driveID (advanced)
   \ (driveid)
 6 / Type in SiteID (advanced)
   \ (siteid)
   / Sharepoint server-relative path (advanced)
 7 | E.g. /teams/hr
   \ (path)
config_type> 1         #选1

出现11:
选择您要使用的驱动器
默认回车,也可以使用图中所示的数字
image-1660178453060

出现12:

Drive OK?

Found drive "root" of type "business"
URL: https://6h48rf-my.sharepoint.com/personal/ktffmin_e5_marisalnc_com/Documents

y) Yes (default)
n) No
y/n> y              #选y

出现13:

Keep this "od" remote?
y) Yes this is OK (default)
e) Edit this remote
d) Delete this remote
y/e/d> y  #选y

最后:
q退出
image-1660178732769

3.1 查看是否连接成功

rclone lsd name:/         #name为一开始输入的name

本文命令:

rclone lsd od:/       

image-1660178949597

4.挂载

4.1 创建挂载目录

mkdir data

4.2 挂载为本地硬盘

rclone mount Name:/ /root/data --copy-links --no-gzip-encoding --no-check-certificate --allow-other --allow-non-empty --umask 000 --daemon --vfs-cache-mode writes     #name为你一开始输入的name

本文命令:

rclone mount od:/ /root/data --copy-links --no-gzip-encoding --no-check-certificate --allow-other --allow-non-empty --umask 000 --daemon --vfs-cache-mode writes 

4.3

df-h

5.清除挂载

fusermount -qzu /root/data           #qzu后为挂载路径