s3cmd ‘ERROR: Test failed: 403 (AccessDenied): Access Denied’ and ‘ERROR: Config: verbosity level ’20’ is not valid’ [SOLVED]

I’m working on a project that includes sending data via Amazon Simple Storage Service (S3) and was having some problems configuring and using the s3cmd client.

The first thing I discovered about s3cmd is not to trust what it tells you when invoking s3cmd –configure to get things set up to use the bucket.

$ s3cmd -v –configure s3://some-bucket/some-prefix/

Enter new values or accept defaults in brackets with Enter.
Refer to user manual for detailed description of all options.

Access key and Secret key are your identifiers for Amazon S3
Access Key: thisisanaccesskey
Secret Key: thisisasecretkey

Encryption password is used to protect your files from reading
by unauthorized persons while in transfer to S3
Encryption password:
Path to GPG program:

When using secure HTTPS protocol all communication with Amazon S3
servers is protected from 3rd party eavesdropping. This method is
slower than plain HTTP and can’t be used if you’re behind a proxy
Use HTTPS protocol [No]: Y

New settings:
  Access Key:
thisisanaccesskey
  Secret Key:
thisisasecretkey
  Encryption password:
  Path to GPG program: None
  Use HTTPS protocol: True
  HTTP Proxy server name:
  HTTP Proxy server port: 0

Test access with supplied credentials? [Y/n] y
Please wait, attempting to list bucket:
s3://some-bucket/some-prefix/
ERROR: Test failed: 403 (AccessDenied): Access Denied

Retry configuration? [Y/n] n

Save settings? [y/N] y
Configuration saved to ‘/home/rchapin/.s3cfg’

As you can see, when I ran configure and opted to test the configs, I got a 403 error.  At that point, I assumed that I didn’t have acces to the bucket and went back to the client to try and figure out if I had the right key, if they set up the bucket with the right permissions, blah, blah, blah.

It turns out, that s3cmd simply gave me incorrect information, or the command that it was using to test it wasn’t valid, or it was trying to do something with the bucket that I didn’t have permission to do.

After running the config above, I tried:

$ s3cmd put test.txt s3://some-bucket/some-prefix/
ERROR: Config: verbosity level ’20’ is not valid
test.txt -> s3://some-bucket/some-prefix/test.txt  [1 of 1]
 15 of 15   100% in    0s    67.58 B/s  done

Turns out that I have access after all.

$ s3cmd ls s3://some-bucket/some-prefix/
ERROR: Config: verbosity level ’20’ is not valid
2014-03-01 00:25         0   s3://some-bucket/some-prefix/
2014-03-19 14:06        15   s3://some-bucket/some-prefix/test.txt

It also turns out that appending the ‘-v’ arg when configuring s3cmd causes it to throw the ‘ERROR: Config: verbosity level ’20’ is not valid’ error.

If you delete the .s3cfg file in your home dir, and re-run s3cmd –configure without the -v command it should work as expected.

Just don’t trust the s3cmd –configure test . . . test it yourself and you might find that you have access already.

Leave a Reply