45

I frequently use Google Cloud Storage with at least two accounts: [email protected] and [email protected]. I used gsutil config to create .boto files for both accounts, which I've renamed to personal.boto and work.boto.

It is tiring to have to remember to type cp personal.boto ~/.boto whenever I need to switch between these accounts. Is there a better way?

4 Answers 4

62

The Google Cloud SDK now includes the gcloud tool, which allows you to login and easily switch between accounts.

$ gcloud auth list
Credentialed accounts:
 - [email protected] (active)
To set the active account, run
 $ gcloud config set account <account>

To login to another account, simply run $ gcloud auth login and use another Google account.

0
20

Easiest way to do this is as follows:

$ BOTO_CONFIG=/path/to/personal.boto gsutil cp #...

For more detailed variations on this theme see this thread.

11

For this, use following command to switch to the account you want.

gcloud auth login

This will take you to the Google account switch page which can be used to switch to the relevant user.

1
-1

under windows OS: set BOTO_CONFIG=E:\.boto & e:\gsutil\gsutil.py ls s3://your_bucket/folder

The "E:" is hard driver id in Windows OS. If you have no "E:", just put the full path of your ".boto" file to try.

1
  • 1
    Looks like you probably want to add a little more explanation of what this does. Right now, if anyone runs this, 1. it wont work for them, since they dont have E:, 2. without any explanation, they don't know what E: should be. Commented Dec 24, 2023 at 8:49

Not the answer you're looking for? Browse other questions tagged or ask your own question.