bashamazon-s3configuration-filess3cmd

Configuring s3cmd non-interactively through bash script


I am trying to configure s3cmd. When at the command line,

s3cmd --configure 

runs the wizard and the data entry is straight forward. Now, I want to run this through a bash script. I used:

s3cmd --configure --access_key=XXXXXXX --secret_key=XXXXXX -s --no-encrypt 

and the interactive wizard still pops out asking me the params I just supplied. I then tried dumping out the contents of the config file (.s3cfg) and writing it to a file in the root hoping s3cmd would read it:

s3cmd --configure --access_key=XXXXXXX --secret_key=XXXXXX -s --no-encrypt 
--dump-config 2>&1 | tee .s3cfg

but that didn't work either.. Any ideas? Thanks.


Solution

  • --configure is an interactive mode to define all settings so as soon as you turn this option it will bring the interactive questions mode.

    If you want to script the configuration of the tool, I think you should directly edit the .s3cfg (for mac/linux) or s3cmd.ini (for windows) in your user home directory and set the values you want to set.

    Alternatively you can dump the current settings (as you made with --dump-config) make change and save using s3cmd --config=<new_file>