Initializing Configurations
Before using obsutil, you need to configure the interconnection between obsutil and OBS, including the endpoint and access keys (AK and SK) of OBS. You can use obsutil to perform operations on OBS buckets and objects only after obtaining the OBS authentication.
Prerequisites
- You have downloaded the software package of obsutil. For details, see Download and Installation.
- You have obtained the enabled regions and endpoints of OBS. For details, see Regions and Endpoints.
- You have obtained the access keys (AK and SK). For details, see Creating Access Keys (AK and SK).
Configuration Method
Run the config command to initialize obsutil. For details about the config command, see Updating a Configuration File. The following is an example:
- In Windows
Use the permanent AK and SK for configuring initialization. (You do not need to enter the 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!
Use the temporary AK and SK and security token for configuring initialization:
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!
- In Linux or macOS
Use the permanent AK and SK for configuring initialization. (You do not need to enter the 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!
Use the temporary AK and SK and security token for configuring initialization:
./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 running the preceding commands, a configuration file .obsutilconfig is automatically generated in the same home directory of the user who executes obsutil commands (the ~ directory in Linux or macOS, and the C:\Users\<Username> directory in Windows). .obsutilconfig contains all the configuration information of obsutil.
- For details about the parameters in the .obsutilconfig file, see Parameter Description.
- The .obsutilconfig file contains the AK and SK information of a user. Therefore, it is hidden by default to prevent key disclosure. To query the file, run the following command in the home directory of the user who executes obsutil commands.
- In Windows
dir
- In Linux or macOS
ls -a
or
ls -al
- In Windows
- obsutil encrypts the AK and SK in the .obsutilconfig file to ensure key security.
Checking the Connectivity
After the configuration is complete, you can check whether it is correct by running the following commands:
- In Windows
obsutil ls -s
- In Linux or macOS
./obsutil ls -s
Check the configuration result based on the command output:
- If the command output contains Bucket number, the configuration is correct.
- If the command output contains Http status [403], the access keys are incorrectly configured.
- If the command output contains A connection attempt failed, then OBS cannot be accessed. In this case, check the network condition.
If the command output contains Http status [403], you may not have the required permissions for obtaining the bucket list. In this case, further locate the root cause based on the specific situation.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot