Can rclone be run solely with command line options ? (no config, no env vars)

We (rsync.net) would like to add rclone to our environment.

You can already use rclone with rsync dot net, of course, since we provide plain old SFTP access.

What I mean is, we are going to install rclone on the server side and allow people to run rclone inside their accounts to transfer data from (for instance) S3 to rsync, or rsync to backblaze (or whatever).

The problem is …

An rsync dot net account is a very restricted environment - you can only access a whitelist of commands, you cannot set environment variables … you could create and upload a config file, but doing interactive response with the program (the Q&A to create the config) can be tricky in our environment as well …

My question:

Is it possible to run rclone as a big, long, terrible, ugly command ? No config file, no interactive Q&A, no environment variables - just a big, long command that --explicitly --specifies --exactly --what --I --want and if I want to run it again, I have to --type --it --all --out --again.

Thanks.

1 Like

I believe you must have rclone.conf to define/save the remotes. It’s usually created for you with the interactive “rclone config” command, but you could write it yourself if you wanted to. The syntax is not hard at all, but I don’t believe it’s documented on the site docs.

If it helps, you can put rclone.conf wherever you like and point to it with --config=/my/file.conf.

Apologies for the delay in replying - I’ve been away at the go conference this week!

:smiley:

If you use the latest beta then you can configure everything that goes in the config file as command line arguments so that is a definite step in the right direction :slight_smile:

If you could get the oauth tokens from the user then you can supply them on the command line.

I guess the one thing you can’t do is actually make a remote though, though that would be easy to add, say --make-remote name=type so --make-remote dst=b2. You can already so this with env variables so adding a command line flag for this would be easy I think.

Would you get the config from the user directly, eg as a web form or something like that? Or would the user type in the command line parameters for rclone directly?

If the user had an existing remote you could get them to paste in the result of rclone config show remoteName into a web form and then translate that into command line options.

Would rclone be able to save its config file? The oauth based remotes update their tokens regularly and ideally rclone would save them in its config file. You can supply a path to a config file with the --config directive.

Only a subset of the remotes need oauth though, you can use s3, google cloud storage, b2, mega, box, azure blob, opendrive, qingstor, swift, sftp (and maybe others!) without.

Thank you very much for your reply - I will do some tests with this and let you know how it pans out.

We’re really excited to put this into place.

I made an issue https://github.com/ncw/rclone/issues/2449 about the one bit missing for your plan to succeed. It should be relatively easy to implement though.

I’ve made a test here

https://beta.rclone.org/branch/v1.42-093-gd7c9abcf-fix-2449-create-backend/ (uploaded in 15-30 mins)

This change allows remotes to be created on the fly without a config
file by using the remote type prefixed with a : as the remote name, Eg
:s3: to make an s3 remote.

Note the docs for this https://rclone.org/commands/rclone_config_create/ for creating backends programatically or use the :backend: syntax as described here: https://rclone.org/docs/#syntax-of-remote-paths

1 Like