R Clone non interactive

I’m wanting to script Rclone using node.js on a server, will most likely be using Google Drive to backup the files, however
to generate a config you need to run the interactive rclone config command, select your options and in the case of google drive you have to open a link.

Any suggestions on how to work around this caveat?

Hello @vibe,

You have a couple of options. Either way you need another computer that can log into your Google Drive account through a browser. First off however, you’ll want to get ssh or some other remote terminal and file sharing program setup on the server.

Option 1 - Use the built-in remote setup method.

  1. Remotely connect to the command-line of the server as the user you want to run rclone as ( ssh is your best bet ).
  2. run rclone config ( On the remote server, ideally over ssh )
  3. Create a new remote ( n, enter )
  4. Type the name you want to give the remote, hit enter.
  5. Type drive then hit enter.
  6. Hit Enter (without typing) for the client_id then again for the client_secret, unless you don’t want the defaults. ( If you don’t know what this is, you probably want the defaults )
  7. If it asks for Service Account Credentials... you can hit enter, unless you want to use this feature. ( If you don’t know what this is, you probably want to leave it blank again. )
  8. The next option should say Use auto config? Hit n then enter. this will give you a URL to enter into your browser on your local machine. This will allow you to authenticate the server to access Google drive without opening a URL on the server itself.
  9. Follow the instructions on the Webpage you just opened.
  10. Copy the code back into the remote shell.
  11. Hit Enter.
  12. It may ask you if this is ok, hit y then Enter.

Option 2 - Configure Locally, then Copy Config file.

On your local computer ( the one that can browse the web ), download rclone and configure it as you want it on the server. Then use a program like FileZilla to copy the configuration you created to the remote server over ssh (sftp). You’ll want to put the config file in the directory ~/.config/rclone with the filename rclone.conf. If that directory doesn’t exist, then on the remote host, first run the command, mkdir -p ~/.config/rclone.

Good luck, let me know if I haven’t explained well enough or you want further clarification,
jedi453