1.Linux安装rclone
curl https://rclone.org/install.sh | sudo bash

2.配置Rclone
执行命令:
rclone config
(1)创建一个新盘名称:myGDrive (可自定义)
(2)选择GoogleDrive:18 (根据实际选项选择)
(3)Scope选择:1 Full access all files
(4)其他,直接回车
(5) 直到出现:
Edit advanced config?
y) Yes
n) No (default)
y/n> n #输入n,不修改高级配置

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,使用自动配置

出现类似如下url信息,进行Google授权验证:
http://127.0.0.1:53682/auth?state=v02js9qFfwhXGihDhmZvug

(6)在具有浏览器的win电脑中执行ssh正向代理:
   ssh -L 53682:127.0.0.1:53682 root@rclone所在主机IP
(7)在win电脑(注意必须可以访问www.google.com)浏览器中执行上面url,完成google账号登录认证,认证后会生成一段access_token代码。
(8) 最后退出配置

3、挂载GoogleDrive
(1)安装fuse

Debian或者Ubantu
apt-get update && apt-get install -y fuse

(2)创建本地google文件夹:

  mkdir /root/googledrive

(3) 创建自动启动的rclone服务

  nano  /etc/systemd/system/rclone.service 

 输入以下内容:


[Unit]
Description=Rclone
AssertPathIsDirectory=/root/googledrive
After=network-online.target
[Service]
Type=simple
ExecStart=rclone mount myGDrive:/ /root/googledrive --allow-other --allow-non-empty --vfs-cache-mode full --vfs-cache-max-age 48h --vfs-cache-max-size 1G --vfs-read-chunk-size 128M --vfs-read-chunk-size-limit 1G --buffer-size 128M
ExecStop=fusermount -u /root/googledrive
Restart=on-abort
User=root
[Install]
WantedBy=default.target

(4)设置rclone服务开机自启

systemctl enable rclone
systemctl start rclone

4.rclone列出已经挂载的google网盘文件列表:myGDrive

rclone ls myGDrive:/

5.将文件复制到本地文件夹:/root/googledrive,它会自动同步到google网盘

标签: none

评论已关闭