Rclone backend - specify path of rclone.conf?

Hello all,
I’ve been reading this forum for quite some time and I find the discussion very interesting. My interest in restic increased over time :slight_smile: Today is my first post :slight_smile:

I’m starting to put together the scripts and configuration for the backup of my Fedora Linux box. I will backup to SFTP, S3 and local. I was successful on initializing the repository on the different destinations.

I would like to use the rclone backend. For this I’d like to put the rclone configuration file at the same place as the restic and other configuration files (e.g. $HOME/.restic/).

The rclone command itself allow to specify the configuration file with the --config option. Example:
rclone --config=$HOME/./restic/rclone.conf config

When using the rclone backend with restic, is there a way to specify the path to rclone.conf ? I’d like to now if it’s doable. Otherwise I’ll simply create a symlink.

Thanks.

Hey @MorgothSauron and welcome to the restic community! :slight_smile:

So as far as I understand this is, you have restic and rclone installed. Right?
If that’s the case, then the restic documentation for the rclone backend suggests that you can safely use the rclone environment variables and restic will honor them.
Other Services via rclone

Rclone can be configured with environment variables, so for instance configuring a bandwidth limit for rclone can be achieved by setting the RCLONE_BWLIMIT environment variable:

But there is also this:

The rclone backend has two additional options:

    -o rclone.program specifies the path to rclone, the default value is just rclone
    -o rclone.args allows setting the arguments passed to rclone, by default this is serve restic --stdio --b2-hard-delete --drive-use-trash=false

So maybe this is what you were looking for in the first place.

Hope this helps :slight_smile: And if so, please let us know.

1 Like

@moritzdietz Yes, I already have both restic and rclone installed on my system. I have a repository on S3 that I was able to check using rclone. The rclone environment variables seems very promising. It’s a bit late for me to try now, but I’ll check that tomorrow and post back. Thank you.

1 Like

Awesome! Sure thing - we’re here :wink:

1 Like

Posting back following a quick tests I made.

  • Set environment for SFTP remote
$ export RCLONE_CONFIG_SFTP_TYPE=sftp
$ export RCLONE_CONFIG_SFTP_HOST=piserver
$ export RCLONE_CONFIG_SFTP_USER=restic
$ export RCLONE_CONFIG_SFTP_KEY_FILE=~/.ssh/id_rsa_restic
  • List repository content with rclone only
$ rclone ls sftp:/home/restic/repository | head
2019/09/17 19:22:30 NOTICE: Config file "/home/morgoth/.config/rclone/rclone.conf" not found - using defaults
      155 config
     1314 snapshots/030281668f20f64e587c57a1ca8afb08841fdbbc6b82919cc81cb808e8a73c1f
     1323 snapshots/2b419f95acd16a2c927cf0bd01219adb8e12320f875bc853893a56496aa17573
     1313 snapshots/419b2692d97612a9a8cc81d72ec29203e24b0dedf51b4fafda9ffa85641c8278
     1314 snapshots/629855a73dacd9ca0d91f49c8af850be31f369afd2d16f8be6c8660b5ad58732
     1314 snapshots/6737117275eca6224890411fbc9e6bcdc6e551061fc6cd68c07f777bc7381316
     1314 snapshots/6d821c8e746ba7451b0794599683e3b3fa6b1e4d66f56ed7c8084e00d14efb42
     1313 snapshots/9ecc9d450517a16653746a1cfaccb14ff90c87a2a5df2cc603ab1f54c5bd46cb
     1314 snapshots/befac0b8d2091eb3f6db59537fbdbd09d8d2ba3466de77d8d318212d93617b6a
     1313 snapshots/d7eeba848c1dd8fbbadd79d04a0d11cad0d4a3f0411aaa824c0adc7f245575f4
$ 
  • List snapshots
$ restic -r rclone:sftp:/home/restic/repository list snapshots
rclone: 2019/09/17 19:23:47 NOTICE: Config file "/home/morgoth/.config/rclone/rclone.conf" not found - using defaults
enter password for repository: 
repository 8fe564d8 opened successfully, password is correct
030281668f20f64e587c57a1ca8afb08841fdbbc6b82919cc81cb808e8a73c1f
2b419f95acd16a2c927cf0bd01219adb8e12320f875bc853893a56496aa17573
419b2692d97612a9a8cc81d72ec29203e24b0dedf51b4fafda9ffa85641c8278
629855a73dacd9ca0d91f49c8af850be31f369afd2d16f8be6c8660b5ad58732
6737117275eca6224890411fbc9e6bcdc6e551061fc6cd68c07f777bc7381316
6d821c8e746ba7451b0794599683e3b3fa6b1e4d66f56ed7c8084e00d14efb42
9ecc9d450517a16653746a1cfaccb14ff90c87a2a5df2cc603ab1f54c5bd46cb
befac0b8d2091eb3f6db59537fbdbd09d8d2ba3466de77d8d318212d93617b6a
d7eeba848c1dd8fbbadd79d04a0d11cad0d4a3f0411aaa824c0adc7f245575f4
d9e7acad26fb9b7d41319fbd731d829ac9d9d2c1dcd6607b6f97ec12f2fde480

I got the expected results using only environment variable. I deleted the default rclone config file before starting my testing. I was also able to perform the same test using a S3 backend.

The rclone documentation also indicates:

Rclone can be configured entirely using environment variables

At this stage it’s clear for me that using rclone environment variables is the ideal solution for my use case.

Thank you for the help !

1 Like

Thanks for the detailed report and awesome you got your setup working the way planned to :slight_smile: