在无浏览器的主机上完成rclone配置google drive的auth流程

注:本方法已经发送pull request且合并到官方github文档。
Rclone是一款的命令行工具,支持在不同对象存储、网盘间同步、上传、下载数据。
但是在配置的时候,需要通过浏览器完成auth。如果远程主机没有浏览器,官方给出的提示是在有浏览器的机器上也安装一个rclone,通过有浏览器的主机完成auth操作。

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 "drive" "xxxxxxxxxxxxxxxxxxxxxxxx"
Then paste the result.

或者在有浏览器的机器上也安装配置好rclone,然后将rclone.conf复制到远程主机的 ~/.config/rclone/位置。

但是除了这个方法,还有一个更简单的无需本地安装的方法:

1. 首先通过ssh连接建立一个tunnel:

ssh -L localhost:53682:localhost:53682 user@remote_server

user为远程主机用户名,remote_server为远程主机地址。

2. 在远程主机进行配置操作

rclone config

然后走到如下选项的时候,输入n:

Edit advanced config? (y/n)
y) Yes
n) No
y/n> n

如下选项的时候,输入y

Remote config
Use auto config?
 * Say Y if not sure
 * Say N if you are working on a remote or headless machine
y) Yes
n) No
y/n> y

然后将随后出现的网址粘贴到本地机器的浏览器上即可:

2022/05/14 06:40:24 NOTICE: If your browser doesn't open automatically go to the following link: http://127.0.0.1:53682/auth?state=xxxxxxxxxxxxx
2022/05/14 06:40:24 NOTICE: Log in and authorize rclone for access
2022/05/14 06:40:24 NOTICE: Waiting for code...

成功后会出现Got code提示:

2022/05/14 06:41:26 NOTICE: Got code`

然后Configure this as a Shared Drive (Team Drive)?输入N即可。

参考资料:

  1. Configure Rclone as if Local - Office of Research Computing - BYU
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值