I used to use insync to access my Google Drive account from the command line because it was reliable, however insync ceased support for their CLI client, so I had to rethink that.
I’ve decided to plop with rclone because it’s flexible, lightweight, it works well and it supports over 40 different filesharing platforms, including the most popular ones: Google Drive, Dropbox, Box, Microsoft OneDrive, Amazon Drive/S3. It also supports SSH/SFTP – which is nice, because it presents files/directories on another server just as if they are local files.
The installation & configuration steps are listed below
Run the installer
Firstly, either download the installer script and run it in one go, or if you are paranoid about doing that sorta thing then download, inspect it and run it when you are ready.
To download and run the install process in one step simply launch a terminal and type:
ajross@raspberrypi:~$ sudo curl https://rclone.org/install.sh | sudo bash
If you’d prefer to inspect the script first then:
ajross@raspberrypi:~$ curl https://rclone.org/install.sh -O
(have a look at install.sh with an editor like vim, then):
chmod 700 install.sh
sudo ./install.sh
Configure rclone (interactive)
All going well, the rclone application should now be installed and ready to be configured for your particular cloud file storage setup. Here’s the steps I followed (choices made in red & bold font)
ajross@raspberrypi:~ $ rclone config
No remotes found - make a new one
n) New remote
s) Set configuration password
q) Quit config
n/s/q> n
name> my_drive (nb you can choose any name you like, don't use spaces though).
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
[A list of all the services supported is listed, at the time of writing, number 15 was Google Drive]
Storage> 15
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> (I left this blank)
OAuth Client Secret
Leave blank normally.
Enter a string value. Press Enter for the default ("").
client_secret>
(I left this blank)
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> (I left this blank)
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>
(I left this blank)
Edit advanced config?
y) Yes
n) No (default)
y/n> n
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 (I did this because I was on a raspberry pi which was not attached to a monitor, you may wish to use Y if you are running X and can see graphical output on the display of the machine you are configuring).
Verification code
Go to this URL, authenticate then paste the code here.
https://accounts.google.com/o/oauth2/auth?access_type=offline&client_id(full url suppressed)
Enter a string value. Press Enter for the default ("").
config_verification_code> (I pasted the code I got from Google from going to the above URL)
Configure this as a Shared Drive (Team Drive)?
y) Yes
n) No (default)
y/n> n
--------------------
[my_drive]
type = drive
scope = drive
token = {"access_token":-omitted-"}
team_drive =
--------------------
y) Yes this is OK (default)
e) Edit this remote
d) Delete this remote
y/e/d> y
Current remotes:
Name Type
==== ====
my_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
ajross@raspberrypi:~ $
Check the synchronisation of your data
Although the configuration is now complete, you still need to check the synchronisation of your data:
ajross@raspberrypi:~$ rclone ls my_drive:
Note that the colon (:) is required. The name ‘my_drive’ is the name you supplied earlier during the configuration. All going well, after a few moments you should start to see the list of all your Google Drive (or whatever) files go whizzing by on the display. If you have any issues, just run that command again.
Mount your drive
If all of your files seem present and correct, now it’s time to mount your drive. To do that, make a directory in your home folder to mount it to, and then issue the appropriate mount command:
ajross@raspberrypi:~$ mkdir -p ~/google_drive
ajross@raspberrypi:~$ rclone mount my_drive: ~/google_drive --vfs-cache-mode writes
Depending upon the amount of stuff you have stored, this will take some time do to the initial synchronisation. Feel free to put this task in the background if you like (CTRL-Z and then type bg [RETURN]).
Startup on boot
If you always want to ensure that rclone is running and syncing your content, then you will want to set up the service on boot. You can do this like this:
sudo vim /etc/rc.local
--- put the following line in above the line that says 'exit 0': ---
rclone mount my_drive: /home/<user>/google_drive --vfs-cache-mode writes
Replace my_drive: with whatever drive name you configured and also change <user> with your username.
Done!
That’s it, all going well, you should be able to ‘cd’ into your /home/user/google_drive directory and all your stuff should start appearing in there!
Supported file storage service providers
As of the time of writing, forty-three file sharing services are supported. Here’s the full list:
rclone.org also notes that there are many others, built on standard protocols such as WebDAV or S3, that work out of the box.
- 1Fichier Home Config
- Alibaba Cloud (Aliyun) Object Storage System (OSS) Home Config
- Amazon Drive (See note) Home Config
- Amazon S3 Home Config
- Backblaze B2 Home Config
- Box Home Config
- Ceph Home Config
- Citrix ShareFile Home Config
- C14 Home Config
- DigitalOcean Spaces Home Config
- Dreamhost Home Config
- Dropbox Home Config
- Enterprise File Fabric Home Config
- FTP Home Config
- Google Cloud Storage Home Config
- Google Drive Home Config
- Google Photos Home Config
- HDFS Home Config
- HTTP Home Config
- Hubic Home Config
- Jottacloud Home Config
- IBM COS S3 Home Config
- Koofr Home Config
- Mail.ru Cloud Home Config
- Memset Memstore Home Config
- Mega Home Config
- Memory Home Config
- Microsoft Azure Blob Storage Home Config
- Microsoft OneDrive Home Config
- Minio Home Config
- Nextcloud Home Config
- OVH Home Config
- OpenDrive Home Config
- OpenStack Swift Home Config
- Oracle Cloud Storage Home Config
- ownCloud Home Config
- pCloud Home Config
- premiumize.me Home Config
- put.io Home Config
- QingStor Home Config
- Rackspace Cloud Files Home Config
- rsync.net Home Config
- Scaleway Home Config
- Seafile Home Config
- SeaweedFS Home Config
- SFTP Home Config
- StackPath Home Config
- SugarSync Home Config
- Tardigrade Home Config
- Tencent Cloud Object Storage (COS) Home Config
- Uptobox Home Config
- Wasabi Home Config
- WebDAV Home Config
- Yandex Disk Home Config
- Zoho WorkDrive Home Config
- The local filesystem Home Config