注:本方法已经发送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
即可。
参考资料: