Before using obsutil, you need to configure the OBS endpoint and AK/SK for obsutil to interconnect with OBS. Then, you can use obsutil to operate OBS buckets and objects.
Run the config command (for more information about config, see Updating a Configuration File):
obsutil config -i=xxxxx -k=xxxxx -e=xxxxx
Using a temporary AK/SK pair and a security token:
obsutil config -i=xxxxx -k=xxxxx -t=xxxxx -e=xxxxx
./obsutil config -i=xxxxx -k=xxxx -e=xxxxx
Using a temporary AK/SK pair and a security token:
./obsutil config -i=xxxxx -k=xxxxx -t=xxxxx -e=xxxxx
Parameter |
Optional or Mandatory |
Description |
|---|---|---|
i |
Mandatory |
AK in permanent or temporary security credentials |
k |
Mandatory |
SK in permanent or temporary security credentials |
e |
Mandatory |
Endpoint for accessing OBS, which can contain the protocol type, domain name, and port number (optional), for example, https://your-endpoint:443. (For security purposes, you are advised to use HTTPS. The port number 443 can be omitted.) |
t |
Optional |
Security token in the temporary security credentials. It is mandatory when temporary security credentials are used. |
dir
ls -a
or
ls -al
Method 3: Initialize obsutil in interactive mode.
Using a permanent AK/SK pair (you do not need to enter a token, and press Enter to skip it):
obsutil config -interactive Please input your ak: xxxxxxxxxxxxxxxxxxxxxxxxx Please input your sk: xxxxxxxxxxxxxxxxxxxxxxxxx Please input your endpoint: xxxxxxxxxxxxxxxxxxxxxxxxx Please input your token: Config file url: C:\Users\tools\.obsutilconfig Update config file successfully!
Using a temporary AK/SK pair and a security token:
obsutil config -interactive Please input your ak: xxxxxxxxxxxxxxxxxxxxxxxxx Please input your sk: xxxxxxxxxxxxxxxxxxxxxxxxx Please input your endpoint: xxxxxxxxxxxxxxxxxxxxxxxxx Please input your token: xxxxxxxxxxxxxxxxxxxxxxxxx Config file url: C:\Users\tools\.obsutilconfig Update config file successfully!
Using a permanent AK/SK pair (you do not need to enter a token, and press Enter to skip it):
./obsutil config -interactive Please input your ak: xxxxxxxxxxxxxxxxxxxxxxxxx Please input your sk: xxxxxxxxxxxxxxxxxxxxxxxxx Please input your endpoint: xxxxxxxxxxxxxxxxxxxxxxxxx Please input your token: Config file url: /root/.obsutilconfig Update config file successfully!
Using a temporary AK/SK pair and a security token:
./obsutil config -interactive Please input your ak: xxxxxxxxxxxxxxxxxxxxxxxxx Please input your sk: xxxxxxxxxxxxxxxxxxxxxxxxx Please input your endpoint: xxxxxxxxxxxxxxxxxxxxxxxxx Please input your token: xxxxxxxxxxxxxxxxxxxxxxxxx Config file url: /root/.obsutilconfig Update config file successfully!
After the initial configuration is complete, run the following command to check the connectivity:
obsutil ls -s
./obsutil ls -s
Check the command output:
If the command output contains "Http status [403]", you may not have the required permissions for obtaining the bucket list. A further analysis is required to identify the root cause.