首页 > 其他分享 >使用 rclone 连接 Google Drive

使用 rclone 连接 Google Drive

时间:2024-12-18 19:10:26浏览次数:8  
标签:Google remote rclone default drive Drive access Enter

安装

sudo apt install rclone

配置

rclone config
  1. 配置选项,选 n 新建一个新配置。

    n) New remote
    s) Set configuration password
    q) Quit config
    n/s/q> n
    
  2. 给配置起名,remote

    name> remote
    
  3. 云盘类型,选 13(Google Drive)

    Type of storage to configure.
    Enter a string value. Press Enter for the default ("").
    Choose a number from below, or type in your own value
    1 / 1Fichier
       \ "fichier"
    2 / Alias for an existing remote
       \ "alias"
    3 / Amazon Drive
       \ "amazon cloud drive"
    4 / Amazon S3 Compliant Storage Provider (AWS, Alibaba, Ceph, Digital Ocean, Dreamhost, IBM COS, Minio, Tencent COS, etc)
       \ "s3"
    5 / Backblaze B2
       \ "b2"
    6 / Box
       \ "box"
    7 / Cache a remote
       \ "cache"
    8 / Citrix Sharefile
       \ "sharefile"
    9 / Dropbox
       \ "dropbox"
    10 / Encrypt/Decrypt a remote
       \ "crypt"
    11 / FTP Connection
       \ "ftp"
    12 / Google Cloud Storage (this is not Google Drive)
       \ "google cloud storage"
    13 / Google Drive
       \ "drive"
    14 / Google Photos
       \ "google photos"
    15 / Hubic
       \ "hubic"
    16 / In memory object storage system.
       \ "memory"
    17 / Jottacloud
       \ "jottacloud"
    18 / Koofr
       \ "koofr"
    19 / Local Disk
       \ "local"
    20 / Mail.ru Cloud
       \ "mailru"
    21 / Microsoft Azure Blob Storage
       \ "azureblob"
    22 / Microsoft OneDrive
       \ "onedrive"
    23 / OpenDrive
       \ "opendrive"
    24 / OpenStack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
       \ "swift"
    25 / Pcloud
       \ "pcloud"
    26 / Put.io
       \ "putio"
    27 / SSH/SFTP Connection
       \ "sftp"
    28 / Sugarsync
       \ "sugarsync"
    29 / Transparently chunk/split large files
       \ "chunker"
    30 / Union merges the contents of several upstream fs
       \ "union"
    31 / Webdav
       \ "webdav"
    32 / Yandex Disk
       \ "yandex"
    33 / http Connection
       \ "http"
    34 / premiumize.me
       \ "premiumizeme"
    35 / seafile
       \ "seafile"
    Storage> 13
    
  4. 设置客户端 ID。这里我设置为空。

    ** See help for drive backend at: https://rclone.org/drive/ **
    
    Google Application Client Id
    Setting your own is recommended.
    See https://rclone.org/drive/#making-your-own-client-id for how to create your own.
    If you leave this blank, it will use an internal key which is low performance.
    Enter a string value. Press Enter for the default ("").
    client_id>
    
  5. 设置 OAuth 客户端密钥,留空。

    OAuth Client Secret
    Leave blank normally.
    Enter a string value. Press Enter for the default ("").
    client_secret>
    
  6. 设置访问权限范围,选 1(完全访问所有文件,排除应用程序数据文件夹)

    Scope that rclone should use when requesting access from drive.
    Enter a string value. Press Enter for the default ("").
    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
    
  7. 设置根文件夹 ID,留空。

    ID of the root folder
    Leave blank normally.
    
    Fill in to access "Computers" folders (see docs), or for rclone to use
    a non root folder as its starting point.
    
    Enter a string value. Press Enter for the default ("").
    root_folder_id>
    
  8. 设置服务帐号凭证文件路径。如果不需要使用服务帐号登录可留空。

    Service Account Credentials JSON file path
    Leave blank normally.
    Needed only if you want use SA instead of interactive login.
    
    Leading `~` will be expanded in the file name as will environment variables such as `${RCLONE_CONFIG_DIR}`.
    
    Enter a string value. Press Enter for the default ("").
    service_account_file>
    
  9. 是否编辑高级设置,选 n

    Edit advanced config? (y/n)
    y) Yes
    n) No (default)
    y/n> n
    
  10. 是否使用自动配置。如果选 y,则接下来会打开一个浏览器页面要求登录 Google 帐号,登录后自动完成配置。我选了 y

如果你在服务器上配置 rclone,那么可以开一个 SSH 隧道来完成浏览器登录认证流程。

Remote config
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
  1. 浏览器认证结束,是否配置为团队帐户,选 n
If your browser doesn't open automatically go to the following link: http://127.0.0.1:53682/auth?state=53WUlMU-o_QsIfBe_H5FCA
Log in and authorize rclone for access
Waiting for code...
Got code
Configure this as a team drive?
y) Yes
n) No (default)
y/n> n
  1. 配置完成,选 y 确定。
--------------------
[remote]
scope = drive
token = {"access_token":"xxx","token_type":"Bearer","refresh_token":"xxx","expiry":"xxx"}
--------------------
y) Yes this is OK (default)
e) Edit this remote
d) Delete this remote
y/e/d> y
  1. 退出配置,q
Current remotes:

Name                 Type
====                 ====
remote               drive

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

配置完成后,配置文件会存储在 ~/.config/rclone/rclone.conf

使用

# 列出远程存储中的所有文件
rclone ls remote:

# 将本地目录同步到远程存储的指定文件夹
rclone sync /path/to/local remote:folder

# 复制文件
rclone copy /path/to/local remote:folder

# 比较比较本地和远程文件,检查差异
rclone check /path/to/local remote:folder

标签:Google,remote,rclone,default,drive,Drive,access,Enter
From: https://www.cnblogs.com/Undefined443/p/18615701

相关文章

  • 欢迎 PaliGemma 2 – 来自 Google 的新视觉语言模型
    我们很高兴迎来Google全新的视觉语言模型PaliGemma2,这是PaliGemma的一个新版本。与其前代产品一样,PaliGemma2使用强大的SigLIP进行视觉处理,但在文本解码部分升级到了最新的Gemma2。模型规模和输入分辨率PaliGemma2提供了新的预训练模型,参数规模包括3B、10B和......
  • Win11 OneDrive 报错 0x8004def5
    突然发现我运行了8万多小时的硬盘报C5警告了…抓紧换了块硬盘懒得重装系统直接pe下把文件拷贝到新盘启动后OneDrive报错 0x8004def5…参考下:https://www.minitool.com/news/onedrive-error-code-0x8004def5.html简单判断我这个肯定没那么复杂肯定是直接拷贝文件造成的配置错......
  • Google在架包分析-巴西7
    包信息赌场游戏人气蹿升榜找的一个包。逆向分析丢到jeb大概看了下就发现是之前分析过的方案。参考Google在架包分析-巴西1小游戏方案是cocos打包本地h5,加上cordova框架加载。在代码入口onCreate就能看到ab判断1、获取NetworkInterface.getName判断是否有"tun......
  • Android version has disappeared from Google Play #1700
     IfyouspeakRussian,4pdahasacustom'improvedversion'thatisprobablywhatyouneed.Ican'tlinktoithere,butsomesearchingshouldhelp.Atleastuntilitisopensourced/broughtbacktoanappstore.  Here’stheanswerI......
  • 打造AI驱动的数据库应用:使用Google Bigtable存储和管理Langchain文档
    打造AI驱动的数据库应用:使用GoogleBigtable存储和管理Langchain文档引言GoogleBigtable是一种高性能的键值和宽列存储数据库,专为快速访问结构化、半结构化或非结构化数据而设计。随着AI技术的发展,数据库应用可以利用Bigtable的功能和Langchain集成来提供更智能的用户体......
  • 掌握PageRank算法核心!你离Google优化高手只差一步!
    0前言98年前的搜索引擎体验不好:返回结果质量不高:搜索结果不考虑网页质量,而通过时间顺序检索易被钻空:搜索引擎基于检索词检索,页面中检索词出现的频次越高,匹配度越高,这样就会出现网页作弊的情况。有些网页为了增加搜索引擎的排名,故意增加某个检索词频率当时Google拉里·......
  • Crashpad Handler 进程是与 Crashpad 系统相关的一个后台进程,Crashpad 本身是一个 崩
    CrashpadHandler进程CrashpadHandler进程是与Crashpad系统相关的一个后台进程,Crashpad本身是一个崩溃报告和分析工具,广泛用于许多应用程序中,尤其是GoogleChrome、Electron等浏览器和桌面应用程序。Crashpad的作用和工作原理:Crashpad 主要用于捕捉应用程序崩溃时......
  • 【Google Cloud】VPC Service Controls 的试运行模式
    本文介绍了VPC服务控制的试运行模式。什么是VPCServiceControlsVPCServiceControls是GoogleCloud(以前称为GCP)的一项安全功能。它通过设置一个被称为边界的逻辑围栏,防止从内部到外部和从外部到内部的双向意外访问,从而增强对Google云各种服务API的安全保护......
  • Google在架包分析-巴西4
    包信息之前在应用榜找的几个包都是一家的,一样的方案没啥好分析的。这次就换游戏榜里面找了个包,直接看图标找很好找。逆向分析安装运行,刚开始还是进的A面小游戏,然后我说来抓个包看下,重新打开了一下app,结果直接就B面了,给我整不会了。。。现在的上架方案都这么随意进b面......
  • Ungoogled Chromium127编译指南 Windows篇 - 链接工具修复(十三)
    1.引言在完成Rust编译器包装器的修复后,我们遇到了编译过程最后阶段的链接问题。在Windows环境下,链接器无法正确找到llvm-pdbutil.exe和undname.exe这两个重要工具。本文将详细介绍如何解决这个问题。2.问题分析2.1错误表现链接阶段报错找不到必要的工具:llvm-pdbutil.e......