安装
sudo apt install rclone
配置
rclone config
-
配置选项,选
n
新建一个新配置。n) New remote s) Set configuration password q) Quit config n/s/q> n
-
给配置起名,
remote
name> remote
-
云盘类型,选
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
-
设置客户端 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>
-
设置 OAuth 客户端密钥,留空。
OAuth Client Secret Leave blank normally. Enter a string value. Press Enter for the default (""). client_secret>
-
设置访问权限范围,选
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
-
设置根文件夹 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>
-
设置服务帐号凭证文件路径。如果不需要使用服务帐号登录可留空。
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>
-
是否编辑高级设置,选
n
。Edit advanced config? (y/n) y) Yes n) No (default) y/n> n
-
是否使用自动配置。如果选
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
- 浏览器认证结束,是否配置为团队帐户,选
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
- 配置完成,选
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
- 退出配置,
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