Linux使用原版Rclone挂载Microsoft OneDrive(包含世纪互联OneDrive)

说明

Rclone项目从1.54.0版开始已经支持挂载世纪互联版OneDrive,不再需要使用魔改版了;
如果需要使用Google Drive网盘,可以看这里:Rclone挂载Google Drive为本地硬盘
Rclone的一些使用方法:Rclone 使用教程 – 常用命令参数

获取Token

关于世纪互联版的OneDrive使用Rclone挂载还需要前往 Azure 开通Azure Active Directory服务及权限,然后在Windows PC使用Rclone获取得到Token值,这里就不讲解了,具体可以Google寻找教程;
国际版的OneDrive获取Token就比较简单了,前往Rclone官网下载最新版的Windows程序,解压后得到rclone.exe文件,然后将其复制到C盘根目录下;
打开电脑的cmd(命令提示符)输入以下命令获取Token

// 切换到C盘根目录
cd/

// 获取Token
rclone authorize "onedrive"

输入命令后会自动打开浏览器,在浏览器中登录你要使用的OneDrive账号并确认授权给Rclone
授权完成后会出现以下界面,即代表成功了;
图片[1]-Linux使用原版Rclone挂载Microsoft OneDrive(包含世纪互联OneDrive)-安全小百科
然后回到cmd(命令提示符)记录下出现的Token即可

Paste the following into your remote machine --->
{"access_token":"XXX","token_type":"Bearer","refresh_token":"XXX","expiry":"2021-07-20xxx"}
// 上面一大串就是Token,包含字符头的 "{" 和字符尾的 "}" 全部都要复制下来
<---End paste

Linux安装Rclone

CentOS 安装

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

Debian / Ubuntu 安装

wget https://downloads.rclone.org/rclone-current-linux-amd64.zip

unzip rclone-current-linux-amd64.zip

chmod 0777 ./rclone-*/rclone

cp ./rclone-*/rclone /usr/bin/

rm -rf ./rclone-*

适用于ARM框架安装(如甲骨文Oracle等)

wget https://downloads.rclone.org/rclone-current-linux-arm64.zip

unzip rclone-current-linux-arm64.zip

chmod 0777 ./rclone-*/rclone

cp ./rclone-*/rclone /usr/bin/

rm -rf ./rclone-*

Linux配置Rclone

输入以下命令开始配置Rclone

rclone config

国际版OneDrive

展开查看详情

root@SunPma ~ # rclone config
Current remotes:

Name                 Type
====                 ====
OD01                 onedrive

e) Edit existing remote
n) New remote
d) Delete remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config
e/n/d/r/c/s/q> n
name> OD02      // 自定义配置名称
Type of storage to configure.
Enter a string value. Press Enter for the default ("").
Choose a number from below, or type in your own value
 1 / 1Fichier
    "fichier"
 2 / Alias for an existing remote
    "alias"
 3 / Amazon Drive
    "amazon cloud drive"
 4 / Amazon S3 Compliant Storage Providers including AWS, Alibaba, Ceph, Digital Ocean, Dreamhost, IBM COS, Minio, and Tencent COS
    "s3"
 5 / Backblaze B2
    "b2"
 6 / Box
    "box"
 7 / Cache a remote
    "cache"
 8 / Citrix Sharefile
    "sharefile"
 9 / Compress a remote
    "compress"
10 / Dropbox
    "dropbox"
11 / Encrypt/Decrypt a remote
    "crypt"
12 / Enterprise File Fabric
    "filefabric"
13 / FTP Connection
    "ftp"
14 / Google Cloud Storage (this is not Google Drive)
    "google cloud storage"
15 / Google Drive
    "drive"
16 / Google Photos
    "google photos"
17 / Hadoop distributed file system
    "hdfs"
18 / Hubic
    "hubic"
19 / In memory object storage system.
    "memory"
20 / Jottacloud
    "jottacloud"
21 / Koofr
    "koofr"
22 / Local Disk
    "local"
23 / Mail.ru Cloud
    "mailru"
24 / Mega
    "mega"
25 / Microsoft Azure Blob Storage
    "azureblob"
26 / Microsoft OneDrive
    "onedrive"
27 / OpenDrive
    "opendrive"
28 / OpenStack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
    "swift"
29 / Pcloud
    "pcloud"
30 / Put.io
    "putio"
31 / QingCloud Object Storage
    "qingstor"
32 / SSH/SFTP Connection
    "sftp"
33 / Sugarsync
    "sugarsync"
34 / Tardigrade Decentralized Cloud Storage
    "tardigrade"
35 / Transparently chunk/split large files
    "chunker"
36 / Union merges the contents of several upstream fs
    "union"
37 / Webdav
    "webdav"
38 / Yandex Disk
    "yandex"
39 / Zoho
    "zoho"
40 / http Connection
    "http"
41 / premiumize.me
    "premiumizeme"
42 / seafile
    "seafile"
Storage> 26      // 选择需要挂载的项目
** See help for onedrive backend at: https://rclone.org/onedrive/ **

OAuth Client Id
Leave blank normally.
Enter a string value. Press Enter for the default ("").
client_id>       // 直接回车
OAuth Client Secret
Leave blank normally.
Enter a string value. Press Enter for the default ("").
client_secret>       // 直接回车
Choose national cloud region for OneDrive.
Enter a string value. Press Enter for the default ("global").
Choose a number from below, or type in your own value
 1 / Microsoft Cloud Global
    "global"
 2 / Microsoft Cloud for US Government
    "us"
 3 / Microsoft Cloud Germany
    "de"
 4 / Azure and Office 365 operated by 21Vianet in China
    "cn"
region> 1      // 选择 1
Edit advanced config? (y/n)
y) Yes
n) No (default)
y/n> n      // 选择 n
Remote config
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
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 below:
result> {"access_token":"XXX"}      // 粘贴自己的 Token
Choose a number from below, or type in an existing value
 1 / OneDrive Personal or Business
    "onedrive"
 2 / Root Sharepoint site
    "sharepoint"
 3 / Sharepoint site name or URL (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"
 7 / Sharepoint server-relative path (advanced, e.g. /teams/hr)
    "path"
Your choice> 1      // 选择 1
Found 1 drives, please select the one you want to use:
0: OneDrive (business) id=XXX
Chose drive to use:> 0    // 选择 0
Found drive 'root' of type 'business', URL: https://xxx.xxx.com
Is that okay?
y) Yes (default)
n) No
y/n> y      // 选择 y
--------------------
[OD02]
type = onedrive
region = global
token = {"access_token":"XXX"}
drive_id = XXX
drive_type = business
--------------------
y) Yes this is OK (default)
e) Edit this remote
d) Delete this remote
y/e/d> y      // 选择 y
Current remotes:

Name                 Type
====                 ====
OD01                 onedrive
OD02                 onedrive

e) Edit existing remote
n) New remote
d) Delete remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config
e/n/d/r/c/s/q> q      // 选择 q 配置完成

世纪互联版OneDrive

展开查看详情

root@SunPma ~ # rclone config
Current remotes:

Name                 Type
====                 ====

e) Edit existing remote
n) New remote
d) Delete remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config
e/n/d/r/c/s/q> n
name> OD01      // 自定义配置名称
Type of storage to configure.
Enter a string value. Press Enter for the default ("").
Choose a number from below, or type in your own value
 1 / 1Fichier
    "fichier"
 2 / Alias for an existing remote
    "alias"
 3 / Amazon Drive
    "amazon cloud drive"
 4 / Amazon S3 Compliant Storage Providers including AWS, Alibaba, Ceph, Digital Ocean, Dreamhost, IBM COS, Minio, and Tencent COS
    "s3"
 5 / Backblaze B2
    "b2"
 6 / Box
    "box"
 7 / Cache a remote
    "cache"
 8 / Citrix Sharefile
    "sharefile"
 9 / Compress a remote
    "compress"
10 / Dropbox
    "dropbox"
11 / Encrypt/Decrypt a remote
    "crypt"
12 / Enterprise File Fabric
    "filefabric"
13 / FTP Connection
    "ftp"
14 / Google Cloud Storage (this is not Google Drive)
    "google cloud storage"
15 / Google Drive
    "drive"
16 / Google Photos
    "google photos"
17 / Hadoop distributed file system
    "hdfs"
18 / Hubic
    "hubic"
19 / In memory object storage system.
    "memory"
20 / Jottacloud
    "jottacloud"
21 / Koofr
    "koofr"
22 / Local Disk
    "local"
23 / Mail.ru Cloud
    "mailru"
24 / Mega
    "mega"
25 / Microsoft Azure Blob Storage
    "azureblob"
26 / Microsoft OneDrive
    "onedrive"
27 / OpenDrive
    "opendrive"
28 / OpenStack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
    "swift"
29 / Pcloud
    "pcloud"
30 / Put.io
    "putio"
31 / QingCloud Object Storage
    "qingstor"
32 / SSH/SFTP Connection
    "sftp"
33 / Sugarsync
    "sugarsync"
34 / Tardigrade Decentralized Cloud Storage
    "tardigrade"
35 / Transparently chunk/split large files
    "chunker"
36 / Union merges the contents of several upstream fs
    "union"
37 / Webdav
    "webdav"
38 / Yandex Disk
    "yandex"
39 / Zoho
    "zoho"
40 / http Connection
    "http"
41 / premiumize.me
    "premiumizeme"
42 / seafile
    "seafile"
Storage> 26      // 选择需要挂载的项目
** See help for onedrive backend at: https://rclone.org/onedrive/ **

OAuth Client Id
Leave blank normally.
Enter a string value. Press Enter for the default ("").
client_id> 9390-XXXX     // 输入应用程序客户端ID
OAuth Client Secret
Leave blank normally.
Enter a string value. Press Enter for the default ("").
client_secret> XXX_b3Q5UW     // 输入客户端密码值
Choose national cloud region for OneDrive.
Enter a string value. Press Enter for the default ("global").
Choose a number from below, or type in your own value
 1 / Microsoft Cloud Global
    "global"
 2 / Microsoft Cloud for US Government
    "us"
 3 / Microsoft Cloud Germany
    "de"
 4 / Azure and Office 365 operated by 21Vianet in China
    "cn"
region> 4    // 选择 4
Edit advanced config? (y/n)
y) Yes
n) No (default)
y/n> n    // 选择 n
Remote config
Make sure your Redirect URL is set to "http://localhost:53682/" in your custom config.
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
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" -- "bdd0095e-XXX" "XXX_b3Q5UW"

Then paste the result below:
result> {"access_token":"XXX"}      // 粘贴自己的 Token
Choose a number from below, or type in an existing value
 1 / OneDrive Personal or Business
    "onedrive"
 2 / Root Sharepoint site
    "sharepoint"
 3 / Sharepoint site name or URL (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"
 7 / Sharepoint server-relative path (advanced, e.g. /teams/hr)
    "path"
Your choice> 1    // 选择 1
Found 1 drives, please select the one you want to use:
0: OneDrive (business) id=b!_XXX
Chose drive to use:> 0    // 选择 0
Found drive 'root' of type 'business', URL: https://xxx.sharepoint.cn
Is that okay?
y) Yes (default)
n) No
y/n> y    // 选择 y
--------------------
[OD01]
type = onedrive
client_id = bdd0095e-XXX
client_secret = XXX_b3Q5UW
region = cn
token = {"access_token":"XXX"}
drive_id = b!_XXX
drive_type = business
--------------------
y) Yes this is OK (default)
e) Edit this remote
d) Delete this remote
y/e/d> y    // 选择 y
Current remotes:

Name                 Type
====                 ====
OD01                 onedrive

e) Edit existing remote
n) New remote
d) Delete remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config
e/n/d/r/c/s/q> q    // 选择 q 配置完成

相关推荐: Debian/Ubuntu禁止内核自动更新升级

云筏的KVM系列服务器目前只支持默认版本的Linux内核,更换其他版本的内核可能会出现不兼容的情况,然后IO以及网络速度会变得特别慢。这个问题在产品文档中有专门说明,一般用户不要更新内核就没有问题了,如果用户有能力选择内核的话升级内核到特定版本也是可以正常使用…

© 版权声明
THE END
喜欢就支持一下吧
点赞0
分享
评论 抢沙发

请登录后发表评论