树洞剪藏#剪藏#树洞剪藏

如何在服务器上安装rclone并且挂载Google Drive? - 服务器与建站 - isufe

2025 年 6 月 8 日1 分钟
分享Twitter / XTelegram微博

同步来源:树洞剪藏 源站剪藏 ID:566 原文地址:https://bbs.sufe.me/t/topic/971

打开原文 · 打开源站剪藏快照


如何在服务器上安装rclone并且挂载Google Drive? - 服务器与建站 - isufe

set 限制解除

跳到主要内容

注册

登录

话题

用户

群组

徽章

社区百科wiki

隐私政策链接

即将到来的活动

更多

自家网站

sufe网络服务监控

服务器状态监控

isufe影院

Z-library加速镜像

创世纪图书馆镜像

类别

慢聊时光

社区反馈

所有类别

标签

计算机

自托管

纯水

discourse中文文档

服务器

所有标签

如何在服务器上安装rclone并且挂载Google Drive?

服务器与建站

自托管 , rclone

3月 25 日

1 / 1

3月 25 日

3月 25 日

林青枫 2024龙年纪念

1 7 天

Linux安装

预编译的二进制

获取和拆包

curl -O https://downloads.rclone.org/rclone-current-linux-amd64.zip unzip rclone-current-linux-amd64.zip cd rclone-*-linux-amd64

复制二进制文件

sudo cp rclone /usr/bin/ sudo chown root:root /usr/bin/rclone sudo chmod 755 /usr/bin/rclone

安装手册页

sudo mkdir -p /usr/local/share/man/man1 sudo cp rclone.1 /usr/local/share/man/man1/ sudo mandb

运行 rclone config 进行设置。有关更多详细信息,请参阅 rclone配置文档 。

rclone config

调整配置

具体流程如下:

配置

驱动器的初始设置需要从Google Drive获取令牌,此操作需在浏览器中完成。 rclone config 将引导完成这一过程。

以下是创建名为 remote 的远程连接的示例。首先运行:

rclone config

此指南将引领您完成一个互动式的设置过程:

No remotes found, make a new one? n) New remote r) Rename remote c) Copy remote s) Set configuration password q) Quit config n/r/c/s/q> n name> remote Type of storage to configure. Choose a number from below, or type in your own value [snip] XX / Google Drive \ "drive" [snip] Storage> drive Google Application Client Id - leave blank normally. client_id> Google Application Client Secret - leave blank normally. client_secret> Scope that rclone should use when requesting access from drive. Choose a number from below, or type in your own value 1 / Full access all files, excluding Application Data Folder. \ "drive" 2 / Read-only access to file metadata and file contents. \ "drive.readonly" / Access to files created by rclone only. 3 | These are visible in the drive website. | File authorization is revoked when the user deauthorizes the app. \ "drive.file" / Allows read and write access to the Application Data folder. 4 | This is not visible in the drive website. \ "drive.appfolder" / Allows read-only access to file metadata but 5 | does not allow any access to read or download file content. \ "drive.metadata.readonly" scope> 1 Service Account Credentials JSON file path - needed only if you want use SA instead of interactive login. service_account_file> Remote config 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 n) No y/n> y If your browser doesn't open automatically go to the following link: http://127.0.0.1:53682/auth Log in and authorize rclone for access Waiting for code... Got code Configure this as a Shared Drive (Team Drive)? y) Yes n) No y/n> n Configuration complete. Options: type: drive
  • client_id:
  • client_secret:
  • scope: drive
  • root_folder_id:
  • service_account_file:
  • token: {"access_token":"XXX","token_type":"Bearer","refresh_token":"XXX","expiry":"2014-03-16T13:57:58.955387075Z"} Keep this "remote" remote? y) Yes this is OK e) Edit this remote d) Delete this remote y/e/d> y

请参阅 远程设置文档 ,了解如何在没有互联网浏览器的机器上进行设置。

请注意,如果使用网页浏览器进行自动身份验证,rclone 会在您的本地机器上运行一个网络服务器,以收集 Google 返回的令牌。此服务器仅在打开您的浏览器至您获取验证码的这段时间内运行。此服务器位于 http://127.0.0.1:53682/ ,如果您正在运行主机防火墙,可能需要暂时解除对其的阻止,或者使用手动模式。

然后,您可以按以下方式使用它:

列出驱动器顶级目录中的目录

rclone lsd remote:

列出驱动器中的所有文件

rclone ls remote:

将本地目录复制到名为 backup 的驱动器目录中

rclone copy /home/ source remote:backup

由于Rclone 会在服务器的53682端口验证Google Drive账号,直接在服务器打开不了验证链接,需要从本地进行打开

解决无法在服务器打开网址的问题:使用 SSH 端口转发

设置 SSH 端口转发:

在本地计算机上打开一个新的终端窗口

运行以下命令建立 SSH 隧道:

bash

ssh -L 53682 : 127.0 . 0.1 : 53682 root @your ip(服务器IP)

保持此窗口打开

在服务器上重新运行 rclone 授权命令

这次,在本地浏览器中直接使用 http://127.0.0.1:53682/auth?state= … 链接进行谷歌的网盘鉴权。

检查 Google Drive 配置是否成功

  1. 列出已配置的远程存储

bash

rclone listremotes

如果看到 gdrive: 或您之前配置的名称出现在列表中,则表示基本配置已存在。

  1. 检查 Google Drive 详细信息

这里的gdrive只是示例

bash

rclone about gdrive:

这会显示 Google Drive 存储信息,包括总空间和已用空间。如果命令成功执行,表示连接正常。

  1. 列出 Google Drive 内容

bash

rclone ls gdrive:

这会列出 Google Drive 根目录中的文件和文件夹。如果能看到文件列表,则配置无疑是成功了

8

浏览量

回复

相关话题

话题列表,带有按钮的列标题可以排序。

话题

回复

活动

Rclone 安装指南

服务器与建站

计算机 , 自托管 , rclone

安装 Rclone 是一款用 Go 语言编写的程序,提供单一的二进制文件。 快速入门 下载 适用的二进制文件。 从压缩包中提取 rclone 可执行文件,在 Windows 上为 rclone.exe。 运行 rclone config … 阅读更多

0

3月 25 日

如何使用 rclone 管理 WebDAV?

服务器与建站

自托管 , rclone

WebDAV 路径以 remote:path 的形式指定。 路径可以根据需要深入,例如 remote:directory/subdirectory。 配置 要配置 WebDAV 远程,您需要一个 URL,以及用户名和密码。如果您知道您连… 阅读更多

0

3月 27 日

为甲骨文设置rclone自动备份,防止封号后所有文件丢失!

服务器与建站

服务器 , 甲骨文 , rclone

准备工作 必须设置了rclone的服务,如果没有,按照前面的教程设置。 必须为rclone挂载了网盘,我在这里挂载了谷歌网盘。 创建第一个备份脚本文件 /root/root_multi_backup.sh #!/bin/bash #… 阅读更多

0

3月 27 日

discourse社区文档翻译:如何为社区设置google登录?

discourse论坛攻略

discourse中文文档

本指南介绍如何通过在 Google 云控制台配置 OAuth2 凭据,为您的 Discourse 站点设置 Google 登录集成。 所需用户级别: 管理员 概述 Google 登录允许用户使用自己的 Google 账户登录 Dis… 阅读更多

0

1月 13 日

使用 WGCF 在您的服务器上配置 Cloudflare Warp

服务器与建站

计算机 , 自托管

使用 WGCF 在您的服务器上配置 Cloudflare Warp 下载wgcf二进制文件到服务器上 基本设置 首先,为下载的二进制文件添加执行权限: bash chmod +x wgcf (可选)将二进制文件移动到系统P… 阅读更多

0

3月 17 日

StripeM-Inner '> ">

相关文章