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).
Table of contents
Installation
Install rclone by logging in via SSH, then copying and pasting the following:
mkdir -p ~/bin && bash wget -qO ~/rclone.zip https://downloads.rclone.org/rclone-current-linux-amd64.zip unzip ~/rclone.zip -d ~/ 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 when trying to run the software in that directory. A better alternative is to add the bin directory to PATH.
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:
- Add a new remote with n
- Name it as you wish (for example, onedrive)
- Select OneDrive by entering onedrive
- Press enter to skip through the client_id option
- Press enter to skip through the client_secret option
- 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.
- Add a new remote with n
- Name it as you wish (for example, gdrive)
- Select Google Drive by entering drive
- Press enter to skip through the client_id option
- Press enter to skip through the client_secret option
- Press enter to skip through the service_account_file option
- 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.
- Add a new remote with n
- Name it as you wish (for example, crypt)
- Select Encrypt/Decrypt a remote by entering crypt
- Provide the name of the remote and the path on it you wish to encrypt.
- 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