Rclone
Rclone
安装
Linux/macOS/BSD
sudo -v ; curl https://rclone.org/install.sh | sudo bash
创建 Client ID 和 Client Secret
打开 Google API Console ,选择一个项目或者创建一个新项目
- 点击
启用 API 和服务

- 找到
Google Drive API
并点击

- 点击
启用

- 依次点击
凭据
和配置同意屏幕

- 选择
External
后点击创建

- 输入
应用名称
和用户支持电子邮件

- 输入
电子邮件地址
后点击保存并继续
,然后再次点击保存并继续

- 点击
ADD USERS
后输入自己的账号,然后点击添加
,再点击保存并继续

- 依次点击
凭据
、创建凭据
和OAuth 客户端 ID

应用类型
选择桌面应用
,输入名称
后点击创建

- 记下
客户端 ID
和客户端密钥

- 依次点击
OAuth 权限请求页面
、PUBLISH APP
和确认

新建远程
- 运行
rclone config
进入交互式配置会话后输入n
root@localhost:~# rclone config
No remotes found, make a new one?
n) New remote
s) Set configuration password
q) Quit config
n/s/q> n
- 输入名称
Enter name for new remote.
name> google-drive
- 找到
Google Drive
并输入对应的数字,当前为17
Option Storage.
Type of storage to configure.
Choose a number from below, or type in your own value.
...
16 / Google Cloud Storage (this is not Google Drive)
\ (google cloud storage)
17 / Google Drive
\ (drive)
18 / Google Photos
\ (google photos)
...
Storage> 17
- 输入前面记下的
客户端 ID
和客户端密钥
Option client_id.
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 value. Press Enter to leave empty.
client_id> 831060968648-*******************************9.apps.googleusercontent.com
Option client_secret.
OAuth Client Secret.
Leave blank normally.
Enter a value. Press Enter to leave empty.
client_secret> GOCSP***************************Dxe
- 输入
1
Option scope.
Comma separated list of scopes that rclone should use when requesting access from drive.
Choose a number from below, or type in your own value.
Press Enter to leave empty.
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
- 按 Enter 键跳过
Option service_account_file.
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 value. Press Enter to leave empty.
service_account_file>
- 输入
n
或者按 Enter 键使用默认值n
Edit advanced config?
y) Yes
n) No (default)
y/n> n
- 输入
n
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 (default)
n) No
y/n> n
- 找到高亮的部分并粘贴到本地终端运行
Option config_token.
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" "eyJjbGll***************************************************************************************************************************************************************************************************yaXZlIn0"
Then paste the result.
Enter a value.
config_token>
- 在打开的浏览器页面中登录,然后依次点击
高级
和转至xxxxxx(不安全)

- 点击
继续

- 出现
Success!
后回到本地终端,找到高亮的部分并粘贴到服务器上
Paste the following into your remote machine --->
eyJ0b2tl************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************MFwifSJ9
<---End paste
- 输入
n
或者按 Enter 键使用默认值n
Configure this as a Shared Drive (Team Drive)?
y) Yes
n) No (default)
y/n> n
- 输入
y
或者按 Enter 键使用默认值y
Configuration complete.
Options:
- type: drive
- client_id: 831060968648-*******************************9.apps.googleusercontent.com
- client_secret: GOCSP***************************Dxe
- scope: drive
- token: {"access_token":"ya29.a0A**********************************************************************************************************************************************************************************************************vkRw0171","token_type":"Bearer","refresh_token":"1//0gsFa***************************************************************************************nTLPIcyo","expiry":"2024-06-11T09:38:00.000000+08:00"}
- team_drive:
Keep this "google-drive" remote?
y) Yes this is OK (default)
e) Edit this remote
d) Delete this remote
y/e/d> y
- 输入
q
退出交互式配置会话
Current remotes:
Name Type
==== ====
google-drive 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