0

I have received a username, access key ID, and secret access key ID for a public dataset on Amazon S3 (public for authorised users). I have been using s3cmd with my private account and S3 buckets. How can I configure s3cmd so that at the same time I can access my previous private credentials, and the new public data credentials I have received?

Arman
  • 927
  • 3
  • 12
  • 32

1 Answers1

2

When first configuring s3cmd you probably ran s3cmd --configure and input your access and secret keys. This saves the credentials to a file ~/.s3cfg looking something like this:

[default]
access_key=your_access_key
...bunch of options...
secret_key=your_secret_key

s3md accepts the -c flag to point at a config file. Set up two config files, one with your first set of credentials (for example, ~/.s3cfg-private) and one with the other set (for example, ~/.s3cfg-public). Then you can use:

s3cmd -c ~/.s3cfg-public s3://my-public-bucket
s3cmd -c ~/.s3cfg-private s3://my-private-bucket 

For convenience, leave the credentials you need most frequently in the file named ~/.s3cfg as it will be used by default.

Ben Whaley
  • 32,811
  • 7
  • 87
  • 85