windows10:Rclone官方版1.54.0挂载世纪互联(含sharepoint)到本地磁盘

技术分享8字数 6273阅读模式

Rclone官方版1.54.0已正式支持世纪互联(含sharepoint),现在安装已经不需要啥魔改版本了。具体的rclone介绍就不多做解释了,这里就直接开始挂载。如果喜欢挂载到vps上,可以看看这个教程:宝塔面板利用rclone挂载onedrive,sharepoint到自己的vps服务器上

windows10:Rclone官方版1.54.0挂载世纪互联(含sharepoint)到本地磁盘

1、简介

目前最新版本是1.54.0,已经正常支持世纪互联(含sharepoint)!

官网:https://rclone.org/

项目:https://github.com/rclone/rclone

下载:https://github.com/rclone/rclone/releases

2、windonws10安装rclone

1)Windows客户端:rclone-v1.54.0-windows-amd64.zip

2)下载后将其解压,并将rclone.exe移动到C:\Windows\System32这个目录,这样就可以使用rclone命令了,如下截图。

查询版本命令:rclone -V,可以在cmd中查询,也可以在powershell中查询。

PS C:\WINDOWS\system32> rclone -V
rclone v1.54.0
- os/arch: windows/amd64
- go version: go1.15.7

3)在cmd窗口继续输入命令rclone config进行配置,输入n新建一个远程,并取一个名字,比如od

PS C:\WINDOWS\system32> rclone config

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

4)输入名称后,找到OneDrive,目前最新版1.54.0,od序号是26,不是固定的,会随着版本号改变。

C:\Users\daniao>rclone config
No remotes found - make a new one
n) New remote
s) Set configuration password
q) Quit config
n/s/q> n
name> od
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  #这里选择26,其他的可以选择别的序号
** See help for onedrive backend at: https://rclone.org/onedrive/ **

5)下面就需要输入Client Secret和Client Id,因为站长这里用的是同济的校友,所以需要先输入(如果你还么有,那么这之前的工作就是你要建立一个空全局,教程看这里:世纪互联空全局订阅获取Azure+自建独享API

注意,如果是其他的可以直接略过。

OAuth Client Id
Leave blank normally.
Enter a string value. Press Enter for the default ("").
client_id> #这里填入自己的id
OAuth Client Secret
Leave blank normally.
Enter a string value. Press Enter for the default ("").
client_secret> #填入自己的secret
Choose national cloud region for OneDrive.
Enter a string value. Press Enter for the default ("global").

6)选择世纪互联和其他一堆操作。

我们看到序号4,是世纪互联,其他就跟着教程走。这里就不细说了。

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> y #选择y
If your browser doesn't open automatically go to the following link: http://127.0.0.1:53682/auth?state=A_tjjKrdfKTLdPftq9phRw
Log in and authorize rclone for access
Waiting for code...
Got code

7)这之后,会进入登录页面,输入你的账号和密码登录即可,会自动获得token,如果打不开可以把前面的网址换为:https://login.chinacloudapi.cn/common,后面的都不要动。之后的操作如下:

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,od和sharepoint都是支持的,自己根据需要选择
Found 1 drives, please select the one you want to use:
0: OneDrive (business) id=b!5sR5nrtytytytytytytyVITcXXmJQaF8EznkrHDU
Chose drive to use:> 0  #选择0
Found drive 'root' of type 'business', URL: https://universitytongji-my.sharepoint.cn/personal/suoquhao_alumni_tongji_edu_cn/Documents
Is that okay?
y) Yes (default)
n) No
y/n> y  #选择y

8)之后会出现token等配置,会自动生产配置文件,这里配置好,就算是结束了,下面的工作就是挂载,具体如下:

--------------------
[od]
type = onedrive
client_id = a58cc5
client_secret = YQ
region = cn
token = {"access_token":"eyJ0eXAiOiJKV1QiLCJub25jZSI6IjhrZ19JdUR0XzNzaklJanVlb052cFozVjlqWGp5czhRbE03Ym9WYmtkSE0iLCJ0VuE-hIAA","expiry":"2021-02-04T17:41:16.475507+08:00"}
drive_id = b!5sR5nWktPUG
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
====                 ====
od                   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退出配置

3、挂载到本地磁盘

1)挂载之前需要下载Winfsp,没有这玩意挂载会出错。

Winfsp下载:https://github.com/billziss-gh/winfsp/releases

下载之后直接安装即可,无需修改安装位置,一路按默认的点下去就可。

2)查找配置好的配置文件可以用如下命令,rclone.conf中有你之后要用到token。

rclone config file

使用效果

C:\Users\ddd>rclone config file
Configuration file is stored at:
C:\Users\ddd\.config\rclone\rclone.conf

3)打开cmd,输入如下挂载命令。

rclone mount od:/ F: --cache-dir D:\Temp\OneDrive --vfs-cache-mode writes

意思就是把od所有文件挂载到F盘符下,缓存存储在D:\Temp\OneDrive下。这个mount后面的onedrive是你之前输入的名字,大鸟这里是od。

看到网上很多教程说需要在Git CMD中输入挂载命令,新版本之后看来不需要了这个了。直接挂载就能看到盘符。

4)挂载成功如下:

C:\Users\ddd>rclone mount od:/ F: --cache-dir D:\Temp\OneDrive --vfs-cache-mode writes
The service rclone has been started.

看看截图:

windows10:Rclone官方版1.54.0挂载世纪互联(含sharepoint)到本地磁盘

出现了盘符F。

4、开机自动挂载

到这里还没结束,电脑重启后磁盘会消失,下面看看怎么解决。

新建两个文件,分别为rclone.bat和rclone.vbs

1)rclone.bat中写入上述挂载命令:

rclone mount od:/ F: --cache-dir D:\Temp\OneDrive --vfs-cache-mode writes

2)rclone.vbs设置开机自动调用cmd运行rclone.bat文件并退出cmd,写入如下代码:

CreateObject("WScript.Shell").Run "cmd /c D:/rclone.bat",0

3)将rclone.bat文件放到D盘(或其他的盘)目录下,我放在了D盘,所以在rclone.vbs中该文件的路径就是D:/rclone.bat

4)将rclone.vbs文件放到windows系统启动项目录下,在文件夹的路径框中输入如下代码:即可进入启动项目录

%USERPROFILE%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

至此,onedrive磁盘的挂载完成,且电脑下次开机时onedrive磁盘也不会消失,同理sharepoint同样的挂载方法。

5、最后

挂载后,访问速度不是太快,个人感觉没有微软官方提供的OneDrive程序打开的速度快。配置也很麻烦,其实完全可以用微软官方提供的OneDrive程序来部署。

参考资料:

https://rclone.org/commands/rclone_mount/

https://blog.csdn.net/lb_auto/article/details/105751277

weinxin
我的微信
微信公众号
关注大鸟博客公众号
 最后更新:2021-2-5
大鸟
  • rclone
  • Rclone支持世纪互联
  • rclone支持sharepoint
  • rclone挂载世纪互联
  • rclone挂载sharepoint
  • win10 rclone挂载世纪互联
评论  8  访客  5  作者  3
    • 一名匿名网友
      一名匿名网友 1

      不明白sharepoint ,世纪互联和onedrive 之间有啥区别,好像都是微软的网盘

        • 大鸟
          大鸟

          @ 一名匿名网友 世纪互联是国内的版本的OneDrive!

            • zjboy
              zjboy 4

              @ 大鸟 大佬,那个获取token的网址好像无效,没有值返回来

                • 大鸟
                  大鸟

                  @ zjboy 有效,如果没有,就是你哪里没设置好。

                    • zjboy
                      zjboy 4

                      @ 大鸟 用手机操作的可以吗?

                      • zjboy
                        zjboy 4

                        @ 大鸟 我的直接出现以下错误: 2021/02/09 21:37:45 Failed to query available drives: HTTP error 400 (400 Bad Request) returned body: “{\r\n \”error\”: {\r\n \”code\”: \”BadRequest\”,\r\n \”message\”: \”Tenant does not have a SPO license.\”,\r\n \”innerError\”: {\r\n \”date\”: \”2021-02-09T13:37:45\”,\r\n \”request-id\”: \”5868e470-90e2-468f-9c4e-c067009f1f88\”,\r\n \”client-request-id\”: \”5868e470-90e2-468f-9c4e-c067009f1f88\”\r\n }\r\n }\r\n}”

                          • 大鸟
                            大鸟

                            @ zjboy id和密钥不对~~

                  • z0z0r4
                    z0z0r4 0

                    2022/07/29 09:43:07 ERROR : One drive root ”: Could not get first deltaLink: BadRequest: Unsupported request: Change tracking is not supported against ‘microsoft.graph.driveItem’.
                    这个怎么处理…

                  匿名

                  发表评论

                  匿名网友

                  :?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

                  确定