[LINUX] S3CMD - fourslickz/notes GitHub Wiki

root@dojo:~# pip3 install s3cmd
Collecting s3cmd
  Downloading s3cmd-2.4.0-py2.py3-none-any.whl (164 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 165.0/165.0 KB 1.8 MB/s eta 0:00:00
Requirement already satisfied: python-magic in /usr/lib/python3/dist-packages (from s3cmd) (0.4.24)
Requirement already satisfied: python-dateutil in /usr/local/lib/python3.10/dist-packages (from s3cmd) (2.9.0.post0)
Requirement already satisfied: six>=1.5 in /usr/lib/python3/dist-packages (from python-dateutil->s3cmd) (1.16.0)
Installing collected packages: s3cmd
Successfully installed s3cmd-2.4.0
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv    
root@dojo:~# s3cmd --configure

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. Leave them empty for using the env variables.
Access Key: {ACCCESS_KEY}
Secret Key: {SECRET_KEY}
Default Region [US]: sgp1

Use "s3.amazonaws.com" for S3 Endpoint and not modify it to the target Amazon S3.
S3 Endpoint [s3.amazonaws.com]: sgp1.digitaloceanspaces.com

Use "%(bucket)s.s3.amazonaws.com" to the target Amazon S3. "%(bucket)s" and "%(location)s" vars can be used
if the target S3 system supports dns based buckets.
DNS-style bucket+hostname:port template for accessing a bucket [%(bucket)s.s3.amazonaws.com]: ayosatu.sgp1.digitaloceanspaces.com

Encryption password is used to protect your files from reading
by unauthorized persons while in transfer to S3
Encryption password: ninja  
Path to GPG program [/usr/bin/gpg]: 

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 only be proxied with Python 2.7 or newer
Use HTTPS protocol [Yes]: 

On some networks all internet access must go through a HTTP proxy.
Try setting it here if you can't connect to S3 directly
HTTP Proxy server name: 

New settings:
  Access Key: 
  Secret Key: 
  Default Region: sgp1
  S3 Endpoint: sgp1.digitaloceanspaces.com
  DNS-style bucket+hostname:port template for accessing a bucket: bucket-name.sgp1.digitaloceanspaces.com
  Encryption password: XXXXX
  Path to GPG program: /usr/bin/gpg
  Use HTTPS protocol: True
  HTTP Proxy server name: 
  HTTP Proxy server port: 0

Test access with supplied credentials? [Y/n] 
Please wait, attempting to list all buckets...
Success. Your access key and secret key worked fine :-)

Now verifying that encryption works...
Success. Encryption and decryption worked fine :-)

Save settings? [y/N] y
Configuration saved to '/root/.s3cfg'