问题
I frequently use Google Cloud Storage with at least two accounts: personal@gmail.com and work@corp.com. 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?
回答1:
The Google Cloud SDK now includes the gcloud
tool, which allows you to login and easily switch between accounts.
$ gcloud auth list
Credentialed accounts:
- youremail@gmail.com (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.
回答2:
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.
回答3:
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.
回答4:
under windows OS: set BOTO_CONFIG=E:\.boto & e:\gsutil\gsutil.py ls s3://your_bucket/folder
来源:https://stackoverflow.com/questions/14409499/how-can-i-use-gsutil-with-multiple-accounts