Changing a config when copying from one GDrive to another

What is the problem you are having with rclone?

When doing rclone sync source: target: --drive-service-account-file=accounts/sa-001.json, in which source: and target: both are Google Drive remotes, it seems that the specified service_account_file is set to both remotes.

I would rather set that service_account_file to target: only, and keep the config for source: remain the same. This is so that I can switch service_account_file when the upload is cut off.

What is your rclone version (output from rclone version)

rclone v1.53.0-DEV

  • os/arch: darwin/amd64
  • go version: go1.15

Which OS you are using and how many bits (eg Windows 7, 64 bit)

  • os/arch: darwin/amd64

Which cloud storage system are you using? (eg Google Drive)

Google Drive

The command you were trying to run (eg rclone copy /tmp remote:tmp)

rclone sync source: target: --drive-service-account-file=accounts/sa-001.json

The rclone config contents with secrets removed.

[source]
type = drive
scope = drive
team_drive = DRIVE1
server_side_across_configs = true
stop_on_upload_limit = true
chunk_size = 256M
token = foobar

[target]
type = drive
scope = drive
team_drive = DRIVE2
server_side_across_configs = true
stop_on_upload_limit = true
chunk_size = 256M

You can do that via environment variables, so set this RCLONE_CONFIG_TARGET_SERVICE_ACCOUNT_FILE to the appropriate service_account_file for it to apply only to the target.

Oh wow, I was not aware of this type of environment variable. That is exactly what I need. Thanks!

In case anybody needs a reference, here is the doc page for it: https://rclone.org/docs/#config-file

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.