Cara Login Google Drive di rclone, untuk OS apa aja asal berbasis Linux!

Logo rclone.

Buat apa? Biar kamu bisa buka Google Drive lewat CLI. Banyak loh kegunaannya, salah satunya Backup / Restore server loh!

Apalagi kalau kamu punya Google Drive unlimited dari perusahaan atau dari kampus. Kebetulan, kampusku (Politeknik Caltex Riau), ngasih email alumni bagian dari email kampus, jadinya dataku tetap aman!

… sudah 16TB didalamnya. Hahahahaha

BTW, tutorial ini dibuat pake server Linode, dan script ini juga bisa dipake di Ubuntu/Debian/CentOS/RedHat/… apa ajalah yang kamu pikirkan. Aku lebih kaget kalau script ini gagal, beneran.

Download Linode Logo in SVG Vector or PNG File Format - Logo.wine
Gatau kenapa, tapi diantara semua cloud provider yang aku pernah pake, Linode adalah salah satu yang aku paling suka logonya.

Instalasi rclone

Oke, sekarang kamu perlu install rclone dari rclone.org. Kalau kamu malas kesana, script instalasi rclone ada disini :

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

Ini bisa kamu jalankan langsung di recovery apapun yang berbasis linux, harusnya.

130 root@finnix:~# curl https://rclone.org/install.sh | sudo bash
...
Updating index cache for path `/usr/share/man/zh_CN/man8'. Wait...done.
Checking for stray cats under /usr/share/man/zh_CN...
Checking for stray cats under /var/cache/man/zh_CN...
Processing manual pages under /usr/share/man/zh_TW...
Updating index cache for path `/usr/share/man/zh_TW/man8'. Wait...done.
Checking for stray cats under /usr/share/man/zh_TW...
Checking for stray cats under /var/cache/man/zh_TW...
Processing manual pages under /usr/local/man...
Updating index cache for path `/usr/local/man/man1'. Wait...done.
Checking for stray cats under /usr/local/man...
Checking for stray cats under /var/cache/man/oldlocal...
87 man subdirectories contained newer manual pages.
3317 manual pages were added.
0 stray cats were added.
0 old database entries were purged.

rclone v1.57.0 has successfully installed.
Now run "rclone config" for setup. Check https://rclone.org/docs/ for more details.

130 root@finnix:~# 

Udah begini? Selamat, rclone sudah terinstal.

Konfigurasi rclone

Kita bisa rclone config untuk konfigurasi Google Drive.

130 root@finnix:~# rclone config
2022/01/28 05:38:54 NOTICE: Config file "/root/.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

Tentunya konfigurasi baru dong? Tekan N lalu enter.

Untuk nama, bebas. Tapi karena Google Drive, aku suka pakai nama yang sama “drive”. Ketik, lalu enter.

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> 

Siapa tau tenggelam di Console mu, ga bisa scroll keatas. Ini list lengkapnya. Untuk Google Drive, ketik “drive” lalu enter.

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> 
Option client_secret.
OAuth Client Secret.
Leave blank normally.
Enter a string value. Press Enter for the default ("").
client_secret> 
Option scope.
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.

Biasanya, rclone akan nanya siapa tau kamu mau pakai API key sendiri. Dan biasanya aku akan kosongin, enter aja, sampai nanti dia tanya scope :

Option scope.
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>                                        

Aku biasanya akan pilih “drive” supaya dia bisa baca semua isi Google Drive ku.

Setelah enter :

Option root_folder_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> 
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 string value. Press Enter for the default ("").
service_account_file> 
Edit advanced config?
y) Yes
n) No (default)
y/n> 

Disini aku enter 3x, untuk skip root_folder_id, service_account_file, dan advanced 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> 

Login ke rclone nya.

Bagian sini, dia akan nanya untuk login. Jawab aja N, supaya dia keluarkan link untuk kita buka di browser.

Option config_verification_code.
Verification code
Go to this URL, authenticate then paste the code here.
https://accounts.google.com/o/oauth2/auth?access_type=offline&client_id=xxxxxxxxxxxxxxxxxxxxxxxxxx

Enter a string value. Press Enter for the default ("").
config_verification_code> 

Copy link diatas, buka di browser kamu. Browser biasa, dan tidak harus di server, dirumah juga bisa.

Login seperti biasa.

.

Ini, diijinkan. Setelah itu dia akan keluarkan sebuah kode.

Copy kode ini, pastekan di Console tadi. Lalu Enter.

Configure this as a Shared Drive (Team Drive)?

y) Yes
n) No (default)
y/n> n
--------------------
[drive]
type = drive
scope = drive
token = {"xxxxx"}
team_drive = 
--------------------
y) Yes this is OK (default)
e) Edit this remote
d) Delete this remote
y/e/d> y
Current remotes:

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

Dia akan nanya Shared Drive, jawab saja N. Lalu Y untuk OK. lalu terakhir Q untuk quit.

Selamat, Google Drive mu sudah terlogin di rclone!

Share Button
Published
Categorized as Tutorial

By Rinaldo Jonathan

Admin of this site. Artis papan PCB. #zoneRinaldo #Controllerism Studio Demon, Stage Angel, Sleepy Developer, Smoke free. Kalkud SHS 2012, PCR G15.

Leave a Reply

Verified by ExactMetrics