41
votes

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

4 Answers

52
votes

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.

19
votes

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.

10
votes

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
votes

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