Rclone is a powerful tool for synchronizing files between local devices and various cloud storage services like Google Drive, Dropbox, OneDrive, and many others. If you frequently work with cloud storage on Linux, Rclone is the best choice for managing and transferring data. In this article, we will guide you through the configuration of Rclone on Linux, so you can start syncing your files right away.
What is Rclone?
Rclone is an open-source tool that allows users to manage multiple cloud storage services in a simple and efficient way. With Rclone, you can upload, download, sync, and even encrypt files on cloud storage platforms.
Now, let’s move on to the core of this operation. Make sure you have an active Google account ready to sync. Here’s how you configure Google Drive as a new remote in Rclone:
Step 1: Initial Setup for Google Drive on Rclone
Run the configuration command:
rclone config
Choose n
to create a new remote:
When prompted, type n
and hit Enter
. Rclone will ask you to name this remote. Let’s name it something simple like Gdrive.
Select the storage type:
Rclone will display a list of cloud services. Type 19 to select Google Drive and move forward. Please note that Google Drive and Google Cloud are different.
client_id>
client_secret>
Let it be empty
To gain full access to Google Drive, select option 1.
service_account_file >
Let it be empty
Authenticate your Google account:
Here’s the interesting part. You’ll be asked if you want to authenticate manually or automatically. Choose y for automatic authentication, which will open a browser to link your Google account. If you’re on a headless server, choose n and paste the URL into a browser on another device.
Grant Rclone access to your Google Drive: Once authenticated, allow Rclone to access your Google Drive. You may see a few security prompts from Google. Just click Allow to proceed.
Save the configuration: After successful authentication, return to the terminal and allow the configuration to be saved by typing y. And that’s it! Your Google Drive remote is now configured.
Step 2: Test Your Remote
Don’t stop at just the configuration. Let’s validate that everything is working as it should. Try listing the files and folders in your Google Drive with the following command:
rclone ls Gdrive:
If you see a list of files and folders, congratulations! The sync is working.
Step 3: Sync Files and Folders
Now comes the real power of Rclone—synchronization. You can easily transfer files from your local machine to Google Drive with a simple command:
rclone copy /path/to/local_folder Gdrive:/destination_folder
Syncing rules: If a file already exists in Google Drive, Rclone won’t duplicate it. This saves both time and bandwidth. For two-way syncing, you can use:
rclone sync /path/to/local_folder Gdrive:/destination_folder
Step 4: Mount Google Drive as a Local Folder
Want to access your Google Drive as if it were a local folder? You can mount Google Drive using Rclone with the following command:
rclone mount mygdrive: ~/mnt/gdrive
Don’t forget, to use this command, you might need to have FUSE installed on your system. FUSE is a kernel module that allows user-space file systems.
This is only temporary; when your computer shuts down or restarts, the mount folder will disappear. To make it permanent, a special method is required. You can follow this article for guidance.
https://www.conslinux.com/rclone-mount-googledrive-onedrive-permanent/
Conclusion
Configuring Rclone on Linux is quick and easy if you follow the steps above. With this tool, you can efficiently manage multiple cloud storage services for file synchronization, backup, or data transfer between cloud providers. Rclone is an excellent solution for Linux users working with several cloud services.
Be sure to check out our website syslinuxdev.web.id for the latest Linux and tech tutorials!