rclone挂载Google Drive云端硬盘网盘

爱游博客
爱游博客
爱游博客
2268
文章
200
评论
2020年7月26日19:37:35 评论 159 4446字阅读14分49秒

前面一篇文章水了一下用rclone魔改版挂载世纪互联onedrive,这里呢继续水一下挂载Google Drive云端硬盘网盘。rclone挂载Google Drive云端硬盘网盘

爱游这里只安装了debian 10系统,所以就以debian 10为例。

使用上一篇 Linux使用rclone挂载世纪互联onedrive 里面的魔改版挂载,原因是我要把世纪互联onedrive里面的资料转存到GD里面,如何安装请参照上一篇文章。

首先初始化配置:

rclone config

这里直接选择n

No remotes found - make a new one
n) New remote
s) Set configuration password
q) Quit config
n/s/q>

输入配置名称(随便输入都行)

name>

选择我们需要挂载的服务商,google drive这里选择13,这个更新后会不一样,自己看着选择

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 / JottaCloud
   \ "jottacloud"
17 / Koofr
   \ "koofr"
18 / Local Disk
   \ "local"
19 / Mail.ru Cloud
   \ "mailru"
20 / Mega
   \ "mega"
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 / QingCloud Object Storage
   \ "qingstor"
28 / SSH/SFTP Connection
   \ "sftp"
29 / Transparently chunk/split large files
   \ "chunker"
30 / Union merges the contents of several remotes
   \ "union"
31 / Webdav
   \ "webdav"
32 / Yandex Disk
   \ "yandex"
33 / http Connection
   \ "http"
34 / premiumize.me
   \ "premiumizeme"
Storage>

到这里直接回车

** 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>

继续回车

Google Application Client Secret
Setting your own is recommended.
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>

继续回车

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.

Note that if this is blank, the first time rclone runs it will fill it
in with the ID of the root folder.

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.
Enter a string value. Press Enter for the default ("").
service_account_file>

输入n

Edit advanced config? (y/n)
y) Yes
n) No
y/n>

输入n

Remote config
Use auto config?
 * Say Y if not sure
 * Say N if you are working on a remote or headless machine
y) Yes
n) No
y/n>

这里就需要把里面的地址复制出来到浏览器获取授权码,然后输入授权码

If your browser doesn't open automatically go to the following link: https://accounts.google.com/o/oauth2/auth?access_type=offline&client_id=202264815644.apps.googleusercontent.com&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&response_type=code&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive&state=FZxUKnVQpv6A
Log in and authorize rclone for access
Enter verification code>

继续输入n

Configure this as a team drive?
y) Yes
n) No
y/n>

完成配置了,输入y

--------------------

type = drive
scope = drive
token = {"access_token":"ya29.a0AfH6S"}
--------------------
y) Yes this is OK
e) Edit this remote
d) Delete this remote
y/e/d>

输入q退出

Name                 Type
====                 ====
go                   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>

到这里就算是全部配置完成,可以去挂载了。

挂载为磁盘

#新建本地文件夹,路径自己定,即下面的LocalFolder
mkdir /root/GoogleDrive
#挂载为磁盘,下面的DriveName、Folder、LocalFolder参数根据说明自行替换
rclone mount DriveName:Folder LocalFolder --copy-links --no-gzip-encoding --no-check-certificate --allow-other --allow-non-empty --umask 000

DriveName为初始化配置填的nameFolderGoogle Drive里的文件夹,LocalFolder为</span>VPS上的本地文件夹。

挂载成功后,输入df -h命令查看即可

rclone挂载Google Drive云端硬盘网盘

卸载磁盘

fusermount -qzu LocalFolder

其他命令

重启:systemctl restart rclone
停止:systemctl stop rclone
状态:systemctl status rclone

如果你想挂载多个网盘,那么将systemd配置文件的rclone.service改成rclone1.service即可,重启动什么的同样换成rclone1

若文章图片、下载链接等信息出错,请在评论区留言反馈,博主将第一时间更新!如果喜欢,请打赏支持本站,谢谢大家!
  • 微信公众号
  • 微信扫一扫
  • weinxin
  • 微信小程序
  • 微信扫一扫
  • weinxin
爱游博客
  • 本文由 发表于 2020年7月26日19:37:35
  • 除非特殊声明,本站文章均为原创,转载请务必保留本文链接