There are several ways to encrypt your data before you send it to the cloud, but if you simply want to back up or sync your data while keeping it private, Rclone has you covered. Rclone is designed to work with established cloud services, no need to set up rsync services on remote machines. Rclone can work with Google Drive, Amazon S3, Dropbox, Google Cloud Storage, Amazon Drive, Microsoft One Drive, Hubic, and Backblaze B2, just to name a few.
Even though Rclone is a command-line tool, setup is easy with the guided menus.
Setup
To start using Rclone, you have to set up remotes, meaning profiles for cloud destinations. Once you have Rclone installed using your Linux distribution’s package manager, you can start setting up Rclone. Type the command rclone config to access a simple guided setup process that’s quite easy to follow.
Rclone requests access to Google DriveAlex CampbellUpon setting up my Google Drive account, Rclone popped open a browser window to ask for access. No need to copy and paste API keys.
The first step is setting up an unencrypted remote. As you can see in my example above, I connected Rclone to my Google Drive account, then named the remote “gdrive.” The configuration automatically opened a browser window in order for me to grant access to my Google account. From there, the configuration application will prompt the user for the path that the user wants to sync. If you’re using a bucket service (like Amazon S3 or Backblaze B2), be sure to enter the name of the bucket you want to use.
Once the initial setup is done, it’s time to set up the encrypted remote, again with rclone config. Encrypted remotes piggyback on remotes that have already been set up. When choosing the type of remote to set up in the configuration program, choose the encrypted remote option (5) Encrypt/Decrypt a remote “crypt.” You’ll be prompted for the name of the remote to piggyback on (in my case gdrive), as well as a name you want to give the encrypted remote.
You’ll also be prompted for passwords and a salt to use to encrypt your files. If you don’t want to bother with creating a super-secret-secure passphrase, you can allow the program to generate a random passphrase and salt for you. You an even ask Rclone to encrypt the names of files and folders so you don’t leak metadata from you filenames.
Once you have the two remotes set up, you’re off to the races.
Sync those files
There are a few ways you can use Rclone to push and pull data to and from the cloud. Unlike its cousin rsync, Rclone won’t do a bidirectional sync (yet). That means choosing a sync method that works best for you.
The first (and probably easiest) way to use Rclone is with the sync command. The sync command synchronizes files from the source to the destination. To sync files from the cloud to a folder (pull), simply use:
rclone sync remote:path /path/to/folder
To sync the other way (push), use:
rclone sync /path/to/folder remote:path
These commands are great if you want to be able to sync manually. There are ways to automatically sync files with Rclone, but they require writing a script or two and a cron job.
The second main method for using Rclone is experimental, but in my opinion, offers a more seamless experience. Rclone can mount a remote using FUSE, which makes the remote appear in file managers as if you connected to a Samba (Windows) share or attached a USB drive. To do this, use the following command:
rclone mount remote:path /path/to/mount &
Just like mounting another filesystem, the folder you mount your remote to must exist on the filesystem (and should be empty). Additionally, the path of the remote is a bit finicky, and the mount process will fail if it doesn’t conform exactly to a valid path.
The mounted Rclone remote shows up like any other attached storage.
For an encrypted remote or a non-bucket remote where you want to mount the root folder, leave the path after remote: blank. However, if you’re connecting to an unencrypted bucket remote, the bucket name is required.
There’s another thing about Rclone’s mount command: It doesn’t play nice with normal mount and unmount commands. When trying to click the eject button in my file manager, I received error popups telling me that FUSE couldn’t unmount the remote. As far as I can tell, Rclone mounts must be manually unmounted with the following command:
fusermount -u /path/to/mount
Rclone with OneDrive
rclone config
|
1
2
3
4
5
|
No remotes found – make a new one
n) New remote
s) Set configuration password
q) Quit config
n/s/q>
|
No remote environments exist yet, so we will select ‘n’
You will then be asked to choose a name for the connection. We recommend using ‘remote’ as this is the same as our examples below.
1
2
|
n/s/q> n
name> remote
|
Select option 19 for Microsoft One Drive
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
19 / Microsoft OneDrive
\ “onedrive”
Storage> 19
Microsoft App Client Id – leave blank normally.
client_id>
Microsoft App Client Secret – leave blank normally.
client_secret>
Edit advanced config? (y/n)
y) Yes
n) No
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
n) No
y/n> y
If your browser doesn‘t open automatically go to the following link: http://127.0.0.1:53682/auth
Log in and authorize rclone for access
Waiting for code...
Got code
|
If you working on a remote machine, select n on line 18, you will need to paste a security token.
you can download a copy of rclone on your local PC which has a web browser
rclone authorize "onedrive"
If your browser doesn't open automatically go to the following link: http://127.0.0.1:53682/auth
Log in and authorize rclone for access
Waiting for code...
Got code
Paste the following into your remote machine --->
{"access_token":"eyJ0eXAiOiJKV1QiLC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iTxWYEuKo4lObLr-HdwphjmxijQ6uQzSU5JWtdZOB3HBVZ2kz3PSDQz-M9l1cKoBXq7Rthcqvg59DiR4r1oop_AtJPYmlpOb3yTcF1IWt9fI6lleVlJTYuix5297o3QavPOYFJbZjurefzYzM_QeM7eWaQC3KqM-v_XUglHp_SZ-btHd8-m-eIS2t_w_nBxCBhLCVEnvVaowRLANf9lEIOMvWYM_GlMBzbPzZXcxBemJE1YOZD0w6B27dJs5JybeZxXwnmOophY_gWlIOWppqqmORehNnF2dXSczHQ4zU7TJuqcrGjv6joBXsDb51nIAO3yBhnee58nn0dJrwEBBHjIRtZRfy5P0t5fgjQlUB9MOChEVNv50tNXIgtu59C8t1l1Nedg7sW6H-veshrfc7WmMyiY19bKKkbMYALeXR4nI2iXF1k0tNMKqy2Mxk8Jfxr76SGMsbSMxBOPxX0Q1WKLDUdYnaLu6eicRZOno5TKSbxN_kdpfCXypoDSm76fmthg7Nr7vQyMy8pr43CyEaK2tVZ31t5bR6blMVxcR9N69VopYaaZbizCQOMxveLSxtF8t_T8TSiAA","expiry":"2019-06-31T12:50:45.4259028+10:00"}
<---End paste
Then copy the code between –> and <– to the remote computer and continue.
https://rclone.org/remote_setup/
List directories in top level of your OneDrive
1
|
rclone lsd remote:
|
List all the files in your OneDrive
1
|
rclone ls remote:
|
To copy a local directory to an OneDrive directory called backup
1
|
rclone copy ~/source remote:backup
|
To copy a network directory to an OneDrive directory called network
1
|
rclone copy /storage/silver/example remote:net/example
|