s3cmd安装与使用

 安装

centos在线安装,yum install s3cmd

配置

执行s3cmd --configure命令,根据提示输入accesskey和scretkey。

注意倒数第二步,Test access with supplied credentials? [Y/n] n,可以选择n,表示不做验证,因为前面过程中输入的可能有错误,如果选择Y,会验证失败,继而导致无法生存配置文件;

跳过验证,后续手动修改配置文件即可;

[root@localhost ~]# 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 [Z475N7JCTN60FK9D9J4I]: 
Secret Key [sNQ7p598G0IpgXPhfOEXUUWPqUvgb3NqE8Ldk4MY]: 
Default Region [us-east-1]: 

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

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 [191.168.221.37:7480/%(bucket)]: 

Encryption password is used to protect your files from reading
by unauthorized persons while in transfer to S3
Encryption password: 
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 [No]: 

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: Z475N7JCTN60FK9D9J4I
  Secret Key: sNQ7p598G0IpgXPhfOEXUUWPqUvgb3NqE8Ldk4MY
  Default Region: us-east-1
  S3 Endpoint: 192.168.221.37:7480
  DNS-style bucket+hostname:port template for accessing a bucket: 191.168.221.37:7480/%(bucket)
  Encryption password: 
  Path to GPG program: /usr/bin/gpg
  Use HTTPS protocol: False
  HTTP Proxy server name: 
  HTTP Proxy server port: 0

Test access with supplied credentials? [Y/n] n

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

修改配置文件:

[root@localhost ~]# vim /root/.s3cfg

注意修改access_key,secret_key,  host_base,host_bucket,

对于host_bucket格式,注意要是否为virtualhost模式,需要做不同设置;

非virtualhost:

host_bucket = 191.168.221.37:7480/%(bucket)

virtualhost:

host_bucket = %(bucket).191.168.221.37:7480

使用

通过s3cmd --help查看具体使用方法;

列举bucket

s3cmd ls s3://
 

列举bucket下的objcet:

s3cmd ls s3://buc1

创建bucket:

s3cmd mb s3://test1
 

 

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值