rclone: Drive backend set doesn't reauth mount

What is the problem you are having with rclone?

https://forum.rclone.org/t/edit-service-account-while-mounted/15760 https://github.com/rclone/rclone/commit/a86196a1569dd9beb701f60fc1f01201a1fa55a6

After the thread above a new feature was introduced to set service account file or chunk-size but using rclone backend set drive: -o service_account_file=newserviceaccount.json doesn’t reauth and keeps using the old service account you restart a mount

What is your rclone version (output from rclone version)

rclone v1.51.0-278-gef9e6794-beta
- os/arch: linux/amd64
- go version: go1.14.2

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

unraid 6.8.3 64 bit , Ubuntu server 16.04.06 LTS 64 bit

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 mount drive: mounttest --allow-other -vvv rclone backend set drive: -o service_account_file=/path/to/newserviceaccount.json output

{
        "service_account_file": {
                "current": "/path/to/newserviceaccount.json",
                "previous": "/path/to/oldserviceaccount.json"
        }
}

A log from the command with the -vv flag (eg output from rclone -vv copy /tmp remote:tmp)

rclone backend set drive: -o service_account_file=/path/to/newserviceaccount.json -vv
2020/05/05 19:38:21 DEBUG : rclone: Version "v1.51.0-278-gef9e6794-beta" starting with parameters ["rcloneorig" "--config" "/boot/config/plugins/rclone-beta/.rclone.conf" "backend" "set" "drive:" "-o" "service_account_file=/path/to/newserviceaccount.json" "-vv"]
2020/05/05 19:38:21 DEBUG : Using config file from "/boot/config/plugins/rclone-beta/.rclone.conf"
2020/05/05 19:38:21 DEBUG : Changing Service Account File from /path/to/oldserviceaccount.json to /path/to/newserviceaccount.json
2020/05/05 19:38:21 DEBUG : Saving config "service_account_file" = " /path/to/newserviceaccount.json" in section "drive" of the config file
{
        "service_account_file": {
                "current": " /path/to/newserviceaccount.json",
                "previous": " /path/to/oldserviceaccount.json"
        }
}
rclone mount drive: /xxx/xxx/xxx/mounttest/ --allow-other -vv
2020/05/05 19:37:52 DEBUG : rclone: Version "v1.51.0-278-gef9e6794-beta" starting with parameters ["rcloneorig" "--config" "/boot/config/plugins/rclone-beta/.rclone.conf" "mount" "drive:" "/xxx/xxx/xxx/mounttest/" "--allow-other" "-vv"]
2020/05/05 19:37:52 DEBUG : Using config file from "/boot/config/plugins/rclone-beta/.rclone.conf"
2020/05/05 19:37:52 DEBUG : Google drive root '': Mounting on "/xxx/xxx/xxx/mounttest/"
2020/05/05 19:37:53 DEBUG : Adding path "vfs/forget" to remote control registry
2020/05/05 19:37:53 DEBUG : Adding path "vfs/refresh" to remote control registry
2020/05/05 19:37:53 DEBUG : Adding path "vfs/poll-interval" to remote control registry
2020/05/05 19:37:53 DEBUG : : Root: 
2020/05/05 19:37:53 DEBUG : : >Root: node=/, err=<nil>
2020/05/05 19:38:53 DEBUG : Google drive root '': Checking for changes on remote
2020/05/05 19:39:53 DEBUG : Google drive root '': Checking for changes on remote

I created 3 different service accounts on three different projects so i could verify api requests

user1 --> project1 --> has access to team drive user2 --> project2 --> has access to team drive user3 --> project3 --> does NOT have acess to team drive

  • Initially mount with user1.json and try to copy files project1 shows api hits

  • backend set drive: service_account_file=user2.json try to again copy some files project2 doesn’t register any api calls

  • unmount and mount again now project2 is registering api hits as its now using user2.json

  • backend set drive: service_account_file=user3.json try to again copy some files project3 doesn’t register any api calls and can still use mount since even though user 3 doesn’t belong to team drive as its still using user2

  • unmount and mount again now user3 is being used since i get a Error 404: Shared drive not found: error

So i’m guessing just changing sa files using backend set doesn’t reauth and use the new service account nor does it check if service account has permission to root folder

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 18 (13 by maintainers)

Most upvoted comments

OK!

I will close this then as I think we have a workaround.

I would pin this to user error since I cannot think of a way to handle the fs not being initialized.

The above requirement can anyway be handled by using the config update command like this: rclone config update newtest service_account_file /home/xxx/sakeys/1.json

No, the error shows that it wasn’t able to set the new service account and the reason for it. Any error while changing the service account results in a full rollback so there is no impact on the config or functionality.

How often can this be done? Any likelihood of running into some sort of google rate limiting if it’s done too much?

As often as you like. I am not aware of any google limits for re-authentication. Do let us know if you find any such limits.