How can I use gsutil with multiple accounts?

fejta picture fejta · Jan 19, 2013 · Viewed 13.4k times · Source

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?

Answer

Hanxue picture Hanxue · Jan 18, 2014

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.