Rclone script to run backup without need to type password

Hello,

I did install rclone on my Synology NAS. My intention is to make a script run every X days, automatically, so the NAS can perform backups to the cloud constantly without me needing to run the commands myself.
I have 2 main concerns while implementing this:
1- I don’t want to leave my passwords unencrypted on the rclone config files, for security reasons. This means that rclone asks password for every command given. How can my script run every X days without the need for me to explicitly write a password in my script?
2 - If I configure the script to run X days, this might be problematic in case rclone still didn’t finish another previous backup. How to be sure that my script will only run rclone if another instance of rclone is not already running.

Hope someone can give me good insights on that.
Thanks for your attention!

2 Likes

This is a hard problem to solve! The only way to do it effectively is with an agent that you unlock once then it keeps the keys in memory.

You can do this with gpg-agent if you are good with gpg, so it can have an unlocked gpg key which you use to decrypt the password.

I guess I could make an rclone agent for this which might be easier for people to use… So maybe you’d run rclone agent, it would ask you for the password to decrypt the config file, then it would run the rclone remote control server so other rclone’s could read the key from it, maybe with a --use-agent flag or something like that.

Locking is your friend here! If you search the forum you will find quite a few scripts which will do what you want.

1 Like

Hey, thanks a lot for taking your time to answer me

I will take a look at gpg-agent, but a --use-agent feature / flag would be great also. I think many people use rclone as a backup tool, so it will probably be useful to many other users.

I will also search for that!
Thanks a lot!

Hi,

I am trying to use rclone to make a scheduled task work safely without password prompting.
I have read the Docs about it :

https://rclone.org/docs/#configuration-encryption

and

https://rclone.org/docs/#password-command-spaceseplist

however I still need help to understand those lines.

in DSM task scheduler (Synology NAS), I wrote a script under the "Run command / User-defined script" section (see screen capture just for example, the shown script in the picture is not the one I am talking about) :

Here is my script :

/path/./rclone --ask-password=false --config /path/.config/rclone/rclone.conf sync --delete-before --checksum --no-update-modtime --transfers 4 --checkers 8 --contimeout 60s --timeout 300s --retries 3 --low-level-retries 10 --stats 1s path remote:path

What do I have to add in this script in order to avoid password prompting ? I really don't understand the docs.

1 Like