Loading

白嫖微软(三)rclone

简介

虽然已经嫖了微软几年。但是笔记一直没有完整记录,最近又开始硬盘焦虑,300G可用,小姐姐怎么办啊,去住onedrive的大别墅吧。

虽然又alist+webdav,但是中转了一下,有什么不中转的办法么?同时要兼顾windows,linux。

首先想到的是:RaiDrive,挂载个人版onedrive,还是不错的,挂载E5的居然要收费才能写入。

那么退而求其次,rclone吧。https://rclone.org/

windows安装

 https://rclone.org/downloads/

下载windows x64,解压就可以用了。

 

 Download · WinFsp

下载winfsp,并安装。

 我解压到C盘根目录了

 在地址栏输入cmd回车,就进入了该目录的命令行

 

linux安装

 配置

这在windows,linux基本一致。

 

下面就在windows下配置,因为配置时会调用浏览器来获取token,cookie这些东西,windows下更方便,我linux是远程的,只有命令行,没桌面,也没浏览器。如果你linux是桌面版,也可以配置。

建议先访问OneDrive (live.com),要么全登录,要么全登出。别只有一个账户登录,会自动登录,导致你无法选择连接的onedrive账号。

看我登录多个账号,就会出现选择

 

 

完整的配置命令

C:\rclone-v1.66.0-windows-amd64>rclone.exe config
No remotes found, make a new one?
n) New remote
s) Set configuration password
q) Quit config
n/s/q> n

Enter name for new remote.
name> OneDrive-Share

Option Storage.
Type of storage to configure.
Choose a number from below, or type in your own value.
 1 / 1Fichier
   \ (fichier)
……
32 / Microsoft Azure Files
   \ (azurefiles)
33 / Microsoft OneDrive
   \ (onedrive)
34 / OpenDrive
   \ (opendrive)
……
55 / seafile
   \ (seafile)
Storage> 33

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

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

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
   \ (global)
 2 / Microsoft Cloud for US Government
   \ (us)
 3 / Microsoft Cloud Germany
   \ (de)
 4 / Azure and Office 365 operated by Vnet Group in China
   \ (cn)
region> 1 

Edit advanced config?
y) Yes
n) No (default)
y/n> 直接回车

Use web browser to automatically authenticate rclone with remote?
 * Say Y if the machine running rclone has a web browser you can use
 * Say N if running rclone on a (remote) machine without web browser access
If not sure try Y. If Y failed, try N.

y) Yes (default)
n) No
y/n> 直接回车

2024/05/02 10:29:29 NOTICE: If your browser doesn't open automatically go to the following link: http://127.0.0.1:53682/auth?state=ExgogZnwHHWh1d1A0vuZNg
2024/05/02 10:29:29 NOTICE: Log in and authorize rclone for access
2024/05/02 10:29:29 NOTICE: Waiting for code...
2024/05/02 10:30:21 NOTICE: Got code
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

Option config_driveid.
Select drive you want to use
Choose a number from below, or type in your own string value.
Press Enter for the default (b!NxmBTsDr8UGtAw5QTRrmZ7rOtAznG6NAhCs_BrjzalvUOt6svbYsTY5lbcPLUHAW).
 1 / OneDrive (business)
   \ (b!NxmBTsDr8UGtAw5QTRrmZ7rOtAznG6NA******************************)
config_driveid> 直接回车

Drive OK?

Found drive "root" of type "business"
URL: https://vb4jy-my.sharepoint.com/personal/jackadam_vb4jy_onmicrosoft_com/Documents

y) Yes (default)
n) No
y/n> 直接回车

Configuration complete.
Options:
- type: onedrive
- token: {"access_token":"*************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************","expiry":"2024-05-02T12:21:23.9967712+08:00"}
- drive_id: b!1m0Xa7YVd02MG*****************************************************
- drive_type: business
Keep this "OneDrive-Share" remote?
y) Yes this is OK (default)
e) Edit this remote
d) Delete this remote
y/e/d> 直接回车

Current remotes:

Name Type
==== ====
OneDrive-Share 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



也就根据提示,n(新建),给个名(OneDrive-Share),选择33(Onedrive网盘),选择1(Global全球服务器),选择1(Onedrive 专业或企业版)。弹出浏览器的时候,选择账号,或者输入账号密码。最后q退出。

生成的配置文件在这里

 

验证

启动

rclone仍然在努力制作gui界面。但是不太完整,我们可以用它验证一下配置文件是否正确。

GUI (rclone.org)

rclone rcd --rc-web-gui

一行命令,启动起来,并自动打开浏览器自动登录,或者看终端输出

可选 

但是不知道用户名密码。可以换一个带用户名和密码的启动命令。

rclone rcd --rc-web-gui --rc-user me --rc-pass mypassword

访问

登录进去就这样

 

 Configs可以看到我们已经生成的配置

 Explorer -- 选择配置名 --  Open

 

可以打开访问

 

 挂载

rclone mount OneDriver-Share:/ Y: --vfs-cache-mode full

Onedriver-Share 是我刚才命名的配置名,Y,是虚拟磁盘盘符。

WinSW自动挂载

Rclone搭配Duplicacy实现小文件高效备份到OneDrive (世纪互联) | 兔肉的随笔 = Usagi no Niku (turou.fun)

将rclone.conf、winsw.exe、复制到同一个目录,再创建rclone.xml如下

<service>
    <id>rclone</id>
    <name>rclone</name>
    <description>This service run rclone mount network file systems to local disk</description>
    <executable>D:\OneDrive\services\rclone\rclone.exe</executable>
    <arguments>mount OneDrive:/ Z: --config %BASE%\rclone.conf --vfs-cache-mode writes --vfs-cache-max-size 30G --vfs-cache-max-age 1h</arguments>
    <log mode="roll"/>
</service>

执行命令注册为服务

winsw install rclone.xml

好了,作为服务,自动启动的rclone就好了。

posted @ 2024-05-02 10:45  上官飞鸿  阅读(39)  评论(0编辑  收藏  举报