本文发布于Cylon的收藏册,转载请著名原文链接~

s3cmd 是为了管理 Linux 服务器上的 S3 存储桶而创建的。 但我们也在 Windows 服务器上使用这个工具。 本文将帮助您在 Windows 系统中设置 s3cmd

Requirment

s3cmd 系统要求: s3cmd 需要 Python 2.7 或更高版本才能运行,还需要安装GPG。

步骤1:安装 Python

python 官方网站下载并安装 python 2.7 或更高版本并安装。安装python后,将将其加到 PATH 环境变量。

步骤 2: 在 Windows 上安装 GPG

Gpg4win (GNU Privacy Guard for Windows) 是一款用于数字加密 (file, email) 的免费软件,可以使用以下链接下载并安装它。

步骤3:配置 s3cmd

下载最新的 s3cmd 源代码 从s3cmd 官方页面 并解压;

提取源代码后,使用以下命令设置 s3 环境。 它会询问您的 对象存储的 AccessKeySecretKey,即 GPG 命令的路径

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
C:s3cmd> python 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
Access Key: XXXXXXXXXXXXXXXXXXXX
Secret Key: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Encryption password is used to protect your files from reading
by unauthorized persons while in transfer to S3
Encryption password: XXXXXXXXX
Path to GPG program: C:\Program Files (x86)\GNU\GnuPG\gpg2.exe

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]: Yes

New settings:
  Access Key: XXXXXXXXXXXXXXXXXXXX
  Secret Key: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  Encryption password: XXXXXXXXX
  Path to GPG program: C:Program Files (x86)GNUGnuPGgpg2.exe
  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 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 'C:\Users\Administrator\Application Data\s3cmd.ini'

步骤4:验证

使用以下命令来验证 s3cmd 配置

1
> python c:\s3cmd\s3cmd ls

本文发布于Cylon的收藏册,转载请著名原文链接~

链接:https://www.oomkill.com/2023/09/05-4-s3cmd-in-windows/

版权:本作品采用「署名-非商业性使用-相同方式共享 4.0 国际」 许可协议进行许可。