Hướng dẫn cấu hình Rclone kết nối với Google Drive

30/12/2020

bài trước chúng ta đã tìm hiểu cách cài đặt Rclone.

Trong bài này, chúng ta sẽ tiếp tục thiết lập cấu hình kết nối đến Google Drive.

Thực hiện lệnh sau:

rclone config

Chương trình hiển thị thông báo No remotes found - make a new one, nhập n để tạo cấu hình mới.

Sau đó, chương trình yêu cầu tên của kết nối, ở đây tôi sẽ nhập ggdrive cho kết nối của mình.

Danh sách dịch vụ lữ trữ đám mây xuất hiện, nhập 13 để chọn Google Drive.

Client ID và Client Secret có thể để trống.

Sau đó mục scope nhập 1 để chọn đầy đủ quyền truy cập thư mục files. (Full access all files, excluding Application Data Folder).

Tiếp theo, để trống với ID of the root folderService Account Credentials JSON file path

Chương trình tiếp tục hỏi Edit advanced config?Use auto config? nhập n

Chương trình tiếp tục yêu cầu xác thực tài khoản Drive, copy link và truy cập link đó trên trình duyệt.

Sau khi đã copy mã xác nhận, quay trở lại server, nhập mã vừa copy được vào dòng Enter verification code.

Tiếp theo dòng Configure this as a team drive? nhập n

Rclone cần xác nhận các thông tin lần cuối, chọn y để tiếp tục.

Chọn q để thoát khỏi chương trình rclone.

Dưới đây là output của quá trình cài đặt rclone:

phuongdm@Phuongdm-PC:~$ rclone config 2020/10/15 11:26:04 NOTICE: Config file "/home/phuongdm/.config/rclone/rclone.conf" not found - using defaults No remotes found - make a new one n) New remote s) Set configuration password q) Quit config n/s/q> n name> ggdrive 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 / 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 ** 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 Client Secret Leave blank normally. Enter a string value. Press Enter for the default (""). client_secret>  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 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>  Edit advanced config? (y/n) y) Yes n) No (default) 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 (default) n) No y/n> n Please go to the following link:  <link xác thực> Log in and authorize rclone for access Enter verification code> Configure this as a team drive? y) Yes n) No (default) y/n> y Fetching team drive list... No team drives found in your account-------------------- [ggdrive] type = drive client_id = client_secret =  scope = drive token = {"access_token":"","token_type":"","refresh_token":"","expiry":""} -------------------- y) Yes this is OK (default) e) Edit this remote d) Delete this remote y/e/d> y Current remotes:  Name                 Type ====                 ==== ggdrive              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

Như vậy là quá trình thiết lập cấu hình với Google Drive đã hoàn tất, có thể kiểm tra hoạt động bằng cách copy file backup.png từ server lên cloud và liệt kê file:

phuongdm@Phuongdm-PC:~$ rclone copy Downloads/backup.png ggdrive: phuongdm@Phuongdm-PC:~$ rclone ls  ggdrive:/     25834 backup.png

Kiểm tra thông tin của Drive:

phuongdm@Phuongdm-PC:~$ rclone about ggdrive: Total:   15G Used:    79.471M Free:    14.922G Trashed: 79.446M Other:   0

Kiểm tra file trên Google Drive:

Một số bài viết liên quan:

ONET IDC thành lập vào năm 2012, là công ty chuyên nghiệp tại Việt Nam trong lĩnh vực cung cấp dịch vụ Hosting, VPS, máy chủ vật lý, dịch vụ Firewall Anti DDoS, SSL… Với 10 năm xây dựng và phát triển, ứng dụng nhiều công nghệ hiện đại, ONET IDC đã giúp hàng ngàn khách hàng tin tưởng lựa chọn, mang lại sự ổn định tuyệt đối cho website của khách hàng để thúc đẩy việc kinh doanh đạt được hiệu quả và thành công.
Bài viết liên quan

Nextcloud [Part 7] – Cài đặt Collabora Online và tích hợp với NextCloud

Mục lục : Cài đặt Collabora Online server Tích hợp Collabora Online với Nextcloud 1. Cài đặt...
30/12/2020

How to List Users on CentOS 7

Linux based operating systems such CentOS are designed to work with mass number of users at the same time. If you’ve...
29/12/2020

Thay đổi timezone của VPS CentOS theo đúng múi giờ Việt Nam

– Kiểm tra múi giờ hiện tại: date – Cập nhật lại timezone sang Asia/Ho_Chi_Minh: rm -f /etc/localtime ln...
28/12/2020
Bài Viết

Bài Viết Mới Cập Nhật

Dịch Vụ Xây Dựng Hệ Thống Peering Với Internet Exchange (IXP)
04/04/2025

Dịch Vụ Triển Khai VPN Site-to-Site & Remote Access
04/04/2025

Dịch Vụ Thiết Lập Hệ Thống Tường Lửa (Firewall)
04/04/2025

Dịch Vụ Triển Khai Hệ Thống Ảo Hóa & Cloud
04/04/2025

Dịch Vụ Triển Khai Hệ Thống Ceph
04/04/2025