rclone

This article will show you how to install rclone and setup remotes for it. Rclone can be used to sync files and directories to and from various cloud storage providers (and your local filesystem).

You'll need to execute some commands via SSH to use this software. There is a separate guide on how to connect to your slot via SSH. Commands are kept as simple as possible and in most cases will simply need to be copied and pasted into the terminal window (then executed by pressing the Enter key).

Installation

Install rclone by logging in via SSH, then copying and pasting the following:

mkdir -p ~/bin && bash
wget -qO ~/rclone.zip http://downloads.rclone.org/rclone-current-linux-amd64.zip
unzip ~/rclone.zip
mv ~/rclone-v*-linux-amd64/rclone ~/bin
rm -rf ~/rclone-v*-linux-amd64 ~/rclone.zip

If your binary directory (~/bin) is not in PATH you'll need to give the full path to any program you wish to run. A better alternative is to simply add ~/bin to PATH with the following commands:

echo "PATH=~/bin:$PATH" > ~/.bashrc
source ~/.bashrc

The rest of the guide assumes you have done this and will simply use rclone to run the rclone binary, instead of ~/bin/rclone.

Configuring

Although rclone can send to many different services, only Microsoft OneDrive and Google Drive are currently covered. Feel free to add others, bearing in mind the format and style below.

Microsoft OneDrive

Since Feral's servers are headless (without a graphical environment), you'll need to configure OneDrive in two parts - the first on your slot and the second on your own computer.

On your slot here at Feral, run the rclone's configuration wizard with rclone config. You'll be presented with a lot of steps to go through:

  1. Add a new remote with n
  2. Name it as you wish (for example, onedrive)
  3. Select OneDrive with 11
  4. Press enter to skip through the client_id option
  5. Press enter to skip through the client_secret option
  6. As it is a headless machine, you'll need to type n in response to Use auto config?

Once you've done this you'll see the following:

For this to work, you will need rclone available on a machine that has a web browser available.
Execute the following on your machine:
        rclone authorize "onedrive"
Then paste the result below:

At this point you'll need to download rclone to your own computer and run a command on it. If on Windows, run rclone.exe authorize "onedrive"; on Linux you can run rclone authorize "onedrive".

Your browser should open, giving you an opportunity to log in to your OneDrive account. After logging in successfully you'll be given a code - copy and paste this into your SSH terminal window.

Once done, you confirm the information with y then press q to quit the config.

Google Drive

Execute rclone config to bring up the config menu, then go through the steps as below.

  1. Add a new remote with n
  2. Name it as you wish (for example, gdrive)
  3. Select Google Drive with 7
  4. Press enter to skip through the client_id option
  5. Press enter to skip through the client_secret option
  6. As it is a headless machine, you'll need to type n in response to Use auto config?

Once you've done this you'll see the following (where $URL is replaced by an actual URL):

If your browser doesn't open automatically go to the following link: $URL
Log in and authorize rclone for access
Enter verification code>

Copy that URL into your browser and login in to grant authorisation. Then, copy and paste the code you get back into the terminal window.

Once done, you confirm the information with y then press q to quit the config.

Creating a remote for encryption/decryption

Creating this type of remote will allow you to encrypt the files you transfer to your "regular" remote and decrypt them on the way back.

  1. Add a new remote with n
  2. Name it as you wish (for example, crypt)
  3. Select Encrypt/Decrypt a remote with 5
  4. Provide the name of the remote and the path on it you wish to encrypt.
  5. Configure your passwords - generating might mean maximum security but you should make a note of the passwords somewhere

Once done, you confirm the information with y then press q to quit the config.

Using rclone

This section will give some brief information on using rclone. As at the top of this page it will not be possible for staff to install FUSE for you, so you will not be able to encrypt the transfers with rclone.

Here are some commands you can run with rclone. To run them, simply execute rclone command where command is replaced by the actual command. Examples can be found after in the section after.

listremotes
This lists the remotes you've set up.
sync feral_path remote:remote_path
This syncs the data on your slot to the remote. It adds files which don't exist on the remote (or have been changed), skips over data which is already present and deletes files on the remote which have also been deleted on your Feral slot.

Please note that variables are used in the example commands above. These variables should be replaced as follows:

feral_path
The path to the file/folder which is on your slot here at Feral
remote
The name of the remote
remote_path
The path to the file/folder on your remote

Example commands

rclone sync ~/private/folder gdrive:/feral

The above command would sync a directory named folder in the private directory of your Feral slot to a directory named feral on your remote, named gdrive

Uninstallation

kill -9 "$(pgrep -fu "$(whoami)" "rclone")"
rm -rf ~/bin/rclone ~/.config/rclone

External links