s3cmd离线安装&使用

logger

摸鱼经验|2024-2-23|最后更新: 2024-2-23|
slug
s3cmd_install_and_usage
status
Published
type
Post
date
Feb 23, 2024
summary
如何使用RPM包安装s3cmd工具,以及如何使用s3cmd
tags
技术
category
摸鱼经验
password
Property
Feb 23, 2024 02:21 AM
icon

安装

yum安装,系统里不同的Python版本选择不同的安装包
python2.6
安装命令:
yum -y install s3cmd-2.0.2-1.el7.noarch.rpm
python2.7
yum -y install s3cmd-2.2.0-1.el7.noarch.rpm

配置

vim ~/.s3cfg
将下面的内容拷贝到文件,并修改:
# 修改下面四个值 [default] access_key = W9P6xxxxxxxxxxxxxxxx9S secret_key = cPYxxxxxxxxxxxxxxxxZtzX host_base = 1.1.1.1:8088 host_bucket = 1.1.1.1:8088 ############修改上面的参数即可############## access_token = add_encoding_exts = add_headers = bucket_location = US ca_certs_file = cache_file = check_ssl_certificate = True check_ssl_hostname = True cloudfront_host = cloudfront.amazonaws.com content_disposition = content_type = default_mime_type = binary/octet-stream delay_updates = False delete_after = False delete_after_fetch = False delete_removed = False dry_run = False enable_multipart = True encrypt = False expiry_date = expiry_days = expiry_prefix = follow_symlinks = False force = False get_continue = False gpg_command = /bin/gpg gpg_decrypt = %(gpg_command)s -d --verbose --no-use-agent --batch --yes --passphrase-fd %(passphrase_fd)s -o %(output_file)s %(input_file)s gpg_encrypt = %(gpg_command)s -c --verbose --no-use-agent --batch --yes --passphrase-fd %(passphrase_fd)s -o %(output_file)s %(input_file)s gpg_passphrase = guess_mime_type = True human_readable_sizes = False invalidate_default_index_on_cf = False invalidate_default_index_root_on_cf = True invalidate_on_cf = False kms_key = limit = -1 limitrate = 0 list_md5 = False log_target_prefix = long_listing = False max_delete = -1 mime_type = multipart_chunk_size_mb = 15 multipart_max_chunks = 10000 preserve_attrs = True progress_meter = True proxy_host = proxy_port = 0 put_continue = False recursive = False recv_chunk = 65536 reduced_redundancy = False requester_pays = False restore_days = 1 restore_priority = Standard send_chunk = 65536 server_side_encryption = False signature_v2 = False signurl_use_https = False simpledb_host = sdb.amazonaws.com skip_existing = False socket_timeout = 300 stats = False stop_on_error = False storage_class = throttle_max = 100 upload_id = urlencoding_mode = normal use_http_expect = False use_https = False use_mime_magic = True verbosity = WARNING website_endpoint = http://%(bucket)s.s3-website-%(location)s.amazonaws.com/ website_error = website_index = index.html

相关命令

# 查询桶 s3cmd ls # 查询桶内文件 s3cmd ls s3://test_bucket # 上传目录,**目录名称不要带/** s3cmd put --acl-public file.txt s3://my-bucket-name/ --recursive # 查询指定目录内文件 s3cmd ls s3://my-bucket-name/test_dir/ # 上传文件时,设置文件权限为所有人可读(--acl-public ) s3cmd put --acl-public file.txt s3://my-bucket-name/ # 下载文件 s3cmd get s3://my-bucket-name/file.txt file.txt # 设置文件权限为所有人可读 s3cmd setacl s3://my-bucket-name/file.txt --acl-public
 
  • Waline
  • Giscus
  • Cusdis