CentOS 通过 rclone 挂载 Goole Drive

CentOS 挂载 Google Drive

软件安装

安装Rclone

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

安装fuse

1
yum install fuse

启动配置

1
rclone config

输入 n 新建

1
2
3
4
5
6
7
8
9
10
11
12
13
14
Current remotes:

Name Type
==== ====
404drive 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> n

定义驱动名字

1
name> drive #输入你想要的名字

选择网盘类型

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
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, 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 / Mega
\ "mega"
22 / Microsoft Azure Blob Storage
\ "azureblob"
23 / Microsoft OneDrive
\ "onedrive"
24 / OpenDrive
\ "opendrive"
25 / OpenStack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
\ "swift"
26 / Pcloud
\ "pcloud"
27 / Put.io
\ "putio"
28 / QingCloud Object Storage
\ "qingstor"
29 / SSH/SFTP Connection
\ "sftp"
30 / Sugarsync
\ "sugarsync"
31 / Tardigrade Decentralized Cloud Storage
\ "tardigrade"
32 / Transparently chunk/split large files
\ "chunker"
33 / Union merges the contents of several upstream fs
\ "union"
34 / Webdav
\ "webdav"
35 / Yandex Disk
\ "yandex"
36 / http Connection
\ "http"
37 / premiumize.me
\ "premiumizeme"
38 / seafile
\ "seafile"
Storage> 13 #网盘类型序号,这里是13,不同版本可能有所改变
1
2
3
4
5
6
7
8
** 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> #无需填写,此处留空
1
2
3
4
Google Application Client Secret
Setting your own is recommended.
Enter a string value. Press Enter for the default ("").
client_secret> #无需填写,此处留空

赋予 rclone 的文件权限选择

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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
1
2
3
4
5
6
7
8
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>
1
2
3
4
5
Service Account Credentials JSON file path 
Leave blank normally.
Needed only if you want use SA instead of interactive login.
Enter a string value. Press Enter for the default ("").
service_account_file>

编辑高级配置

1
2
3
4
Edit advanced config? (y/n)
y) Yes
n) No (default)
y/n> n

远程配置

1
2
3
4
5
6
7
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> n

授权登录

1
2
3
4
Please go to the following link: https://accounts.google.com/o/oauth2/auth?xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
#复制上方链接浏览器打开
Log in and authorize rclone for access
Enter verification code> #这里输入获取到的授权码

选择 Google Drive 类型,y为团队盘,n为个人盘。

1
2
3
4
Configure this as a team drive?
y) Yes
n) No (default)
y/n> n

Google Drive 信息确认

1
2
3
4
5
6
7
8
9
10
--------------------
[drive]
type = drive
scope = drive
token = {"access_token":"ya29.a0AfH6SMAwwg7QRoWUrdZX2LA_RB_DJVHGMUCqH9HUnuWsE-mKJQQuZllLVnxiddxSE9XKonIMZgjAz_PtwQcWAEzhBkr3KioaZ3xSRE-7gpRuGUvFEeVWrBkA3ItC3B6quvBtj4u8wjWCdLb5zB5POwmKuhtw5aKTGaY","token_type":"Bearer","refresh_token":"1//03sjLucGigdxQCgYIARAAGAMSNwF-L9IrodHn5ff_Td3siXUJZ0ZFXmjHbca4rd4c6LTqAr-gaNNO4zngE48jNPed5yjR4T6MhDA","expiry":"2020-09-01T19:56:51.362289593+08:00"}
--------------------
y) Yes this is OK (default)
e) Edit this remote
d) Delete this remote
y/e/d> y
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Current remotes:

Name Type
==== ====
404drive drive
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

[root@srv13938 ~]#