Rclone is a command line program developed to sync files and directories to and from various cloud storage services, like Google Drive, Amazon S3, Dropbox, Microsoft OneDrive and Yandex Disk.
Rclone’s main features are:
- MD5/SHA1 hashes are checked consistently for file integrity
- Timestamps are preserved on files
- Sync to and from the network, e.g: two different cloud accounts
It is written in Go, and distributed under the MIT licence.
In this tutorial, we will install, configure and test rclone on Debian 8.
First, you will need to install Go. It is available in the repository, you just need to execute the command:
# apt install golang
Make sure that you check if the $GOPATH is set:
$ echo $GOPATH
If not, set it just like this:
$ export GOPATH="$HOME/gopath/"
Now that you have installed Go, it’s possible to download rclone by executing the following command:
$ go get -u -v github.com/ncw/rclone
This will download and build the binary in $GOPATH/bin.
As the root, copy the binary to
$ cd $GOPATH/bin # cp rclone /usr/local/bin
Execute the following command:
$ rclone config
This will start the configuration process. After that, the program will print the following output:
No remotes found - make a new one n) New remote s) Set configuration password q) Quit config n/s/q>
Of course, when running the system for the first time, you’ll want to set a new remote, so type ‘n’ and then ENTER.
For the purpose of this tutorial, we will configure access to Dropbox, so, set “dropbox” as the new name
N.B.: you can choose any name you want, of course.
Rclone will print the following text:
Type of storage to configure. Choose a number from below, or type in your own value 1 / Amazon Drive \ "amazon cloud drive" 2 / Amazon S3 (also Dreamhost, Ceph, Minio) \ "s3" 3 / Backblaze B2 \ "b2" 4 / Dropbox \ "dropbox" 5 / Encrypt/Decrypt a remote \ "crypt" 6 / Google Cloud Storage (this is not Google Drive) \ "google cloud storage" 7 / Google Drive \ "drive" 8 / Hubic \ "hubic" 9 / Local Disk \ "local" 10 / Microsoft OneDrive \ "onedrive" 11 / Openstack Swift (Rackspace Cloud Files, Memset Memstore, OVH) \ "swift" 12 / Yandex Disk \ "yandex" Storage>
When you see this text, press ‘4’ and then ENTER.
Leave the next two questions blank. Rclone will print out a URL which you may then visit with a web browser. After logging in with your cloud storage credentials, you will see a code. Copy the code into your terminal to complete the Rclone configuration process. This pass will be required for every cloud storage system you want to set up.
As you can see, the configuration process is very easy and fast. Now it’s time to ensure that you’ve done it correctly!
In my $HOME, I have a text file named “test.txt”. To test Rclone I will execute the command:
$ rclone copy $HOME/test.txt dropbox:
The program should copy it to my remote cloud storage.
This is the simplest case as we are dealing with only one file, but Rclone can also copy folders using this command:
$ rclone copy $HOME/Documents/ dropbox:Documents
Using this command the folder and all of it’s contents should be correctly copied.
It’s also possible to list the content of the remote folder, like this:
$ rclone ls dropbox:
or like this:
$ rclone lsl dropbox:
if you are dealing with lots of information in many stored files.
Rclone also has the ability to create new paths on remote folders. For example, with the following command:
$ rclone mkdir dropbox:/unixmen/gmolica
you can transfer the whole structure of folders to Dropbox, which will create the structure of folders under
It’s also possible to sync two folders using this command:
$ rsync $HOME/Documents dropbox:/Documents
Note that this command will delete any file that exist in the source file but don’t exist in the destination file.
This was just a rapid overview, but it should be helpful! In this tutorial we presented the main features of rclone. Keep in mind that this system is most useful when you just want to check or transfer files to or from a cloud storage service.