Files
doc-exports/docs/obs/tool-obsutil/obs_11_0005.html
weihongmin1 a41a4e0331 OBS Util 0115 Version
Reviewed-by: Sabelnikov, Dmitriy <dmitriy.sabelnikov@t-systems.com>
Co-authored-by: weihongmin1 <weihongmin1@huawei.com>
Co-committed-by: weihongmin1 <weihongmin1@huawei.com>
2026-02-17 10:18:57 +00:00

145 lines
12 KiB
HTML

<a name="obs_11_0005"></a><a name="obs_11_0005"></a>
<h1 class="topictitle1">Initializing the Configuration</h1>
<div id="body1542440101580"><p id="obs_11_0005__p165112513591">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.</p>
<div class="section" id="obs_11_0005__section1544634913019"><h4 class="sectiontitle">Prerequisites</h4><ul id="obs_11_0005__ul3307083115"><li id="obs_11_0005__li13331143810546">You have obtained the enabled <a href="https://docs.otc.t-systems.com/en-us/endpoint/index.html" target="_blank" rel="noopener noreferrer">regions and endpoints</a> of OBS.</li><li id="obs_11_0005__li160201215412">You have obtained the AK/SK. For details, see <a href="obs_11_0061.html">Creating Access Keys (AK and SK)</a>.</li></ul>
</div>
<div class="section" id="obs_11_0005__section14490194733410"><h4 class="sectiontitle">obsutil Initialization Methods</h4><p id="obs_11_0005__p109891024174713">Run the <strong id="obs_11_0005__b39661038174512">config</strong> command (for more information about <strong id="obs_11_0005__b1223416587496">config</strong>, see <a href="obs_11_0023.html">Updating a Configuration File</a>):</p>
<ul id="obs_11_0005__ul61467020416"><li id="obs_11_0005__li41466014413">In Windows<p id="obs_11_0005__p154381470487"><a name="obs_11_0005__li41466014413"></a><a name="li41466014413"></a>Using a permanent AK/SK pair:</p>
<pre class="screen" id="obs_11_0005__screen176751638361">obsutil config -i=xxxxx -k=xxxxx -e=xxxxx</pre>
<p id="obs_11_0005__p122011204261">Using a temporary AK/SK pair and a security token:</p>
<pre class="screen" id="obs_11_0005__screen7639102752610">obsutil config -i=xxxxx -k=<em id="obs_11_0005__i20121144719345">xxxxx</em> -t=xxxxx -e=xxxxx</pre>
</li><li id="obs_11_0005__li12890105114113">In Linux or macOS<p id="obs_11_0005__p1622461714917"><a name="obs_11_0005__li12890105114113"></a><a name="li12890105114113"></a>Using a permanent AK/SK pair:</p>
<pre class="screen" id="obs_11_0005__screen9505151944110">./obsutil config -i=xxxxx -k=xxxx -e=xxxxx</pre>
<p id="obs_11_0005__p1728355511287">Using a temporary AK/SK pair and a security token:</p>
<pre class="screen" id="obs_11_0005__screen32837557285">./obsutil config -i=xxxxx -k=xxxxx -t=xxxxx -e=xxxxx</pre>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="obs_11_0005__table1161369184112" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Parameter description</caption><thead align="left"><tr id="obs_11_0005__row1961412944110"><th align="left" class="cellrowborder" valign="top" width="33.333333333333336%" id="mcps1.3.3.3.2.5.2.4.1.1"><p id="obs_11_0005__p1261411954112"><strong id="obs_11_0005__b4469185719327">Parameter</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="33.29332933293329%" id="mcps1.3.3.3.2.5.2.4.1.2"><p id="obs_11_0005__p561419904112"><strong id="obs_11_0005__b8996155153313">Optional or Mandatory</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="33.373337333733375%" id="mcps1.3.3.3.2.5.2.4.1.3"><p id="obs_11_0005__p46141598418"><strong id="obs_11_0005__b109393253314">Description</strong></p>
</th>
</tr>
</thead>
<tbody><tr id="obs_11_0005__row196149917416"><td class="cellrowborder" valign="top" width="33.333333333333336%" headers="mcps1.3.3.3.2.5.2.4.1.1 "><p id="obs_11_0005__p1061479154110">i</p>
</td>
<td class="cellrowborder" valign="top" width="33.29332933293329%" headers="mcps1.3.3.3.2.5.2.4.1.2 "><p id="obs_11_0005__p76142096415">Mandatory</p>
</td>
<td class="cellrowborder" valign="top" width="33.373337333733375%" headers="mcps1.3.3.3.2.5.2.4.1.3 "><p id="obs_11_0005__p3614199184115">AK in permanent or temporary security credentials</p>
</td>
</tr>
<tr id="obs_11_0005__row136141396415"><td class="cellrowborder" valign="top" width="33.333333333333336%" headers="mcps1.3.3.3.2.5.2.4.1.1 "><p id="obs_11_0005__p19614119114120">k</p>
</td>
<td class="cellrowborder" valign="top" width="33.29332933293329%" headers="mcps1.3.3.3.2.5.2.4.1.2 "><p id="obs_11_0005__p1261419904115">Mandatory</p>
</td>
<td class="cellrowborder" valign="top" width="33.373337333733375%" headers="mcps1.3.3.3.2.5.2.4.1.3 "><p id="obs_11_0005__p18614993413">SK in permanent or temporary security credentials</p>
</td>
</tr>
<tr id="obs_11_0005__row11614199114119"><td class="cellrowborder" valign="top" width="33.333333333333336%" headers="mcps1.3.3.3.2.5.2.4.1.1 "><p id="obs_11_0005__p16614199134116">e</p>
</td>
<td class="cellrowborder" valign="top" width="33.29332933293329%" headers="mcps1.3.3.3.2.5.2.4.1.2 "><p id="obs_11_0005__p661469124113">Mandatory</p>
</td>
<td class="cellrowborder" valign="top" width="33.373337333733375%" headers="mcps1.3.3.3.2.5.2.4.1.3 "><p id="obs_11_0005__p1161479164112">Endpoint for accessing OBS, which can contain the protocol type, domain name, and port number (optional), for example, <strong id="obs_11_0005__obs_11_0035_b53237161197">https://</strong><em id="obs_11_0005__obs_11_0035_i632312161896">your-endpoint</em><strong id="obs_11_0005__obs_11_0035_b1132331611911">:443</strong>. (For security purposes, you are advised to use HTTPS. The port number <strong id="obs_11_0005__obs_11_0035_b1541992001119">443</strong> can be omitted.)</p>
</td>
</tr>
<tr id="obs_11_0005__row56141799416"><td class="cellrowborder" valign="top" width="33.333333333333336%" headers="mcps1.3.3.3.2.5.2.4.1.1 "><p id="obs_11_0005__p261418944119">t</p>
</td>
<td class="cellrowborder" valign="top" width="33.29332933293329%" headers="mcps1.3.3.3.2.5.2.4.1.2 "><p id="obs_11_0005__p196146910410">Optional</p>
</td>
<td class="cellrowborder" valign="top" width="33.373337333733375%" headers="mcps1.3.3.3.2.5.2.4.1.3 "><p id="obs_11_0005__p561414912418">Security token in the temporary security credentials. It is mandatory when temporary security credentials are used.</p>
</td>
</tr>
</tbody>
</table>
</div>
</li></ul>
<div class="note" id="obs_11_0005__note2079015364428"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><ul id="obs_11_0005__ul638485021317"><li id="obs_11_0005__li113841350191318">After the command is executed, there will be the <strong id="obs_11_0005__b357824115483">.obsutilconfig</strong> file created in the directory (<strong id="obs_11_0005__b19132142519516">~</strong> in Linux or macOS or <strong id="obs_11_0005__b2068008133912">C:\Users\&lt;</strong><em id="obs_11_0005__i4423103398">username</em><strong id="obs_11_0005__b3680187392">&gt;</strong> in Windows) where obsutil commands run. This file contains all the configuration information of obsutil.</li><li id="obs_11_0005__li1730003073815">For details about the parameters in the <strong id="obs_11_0005__b6761106191512">.obsutilconfig</strong> file, see <a href="obs_11_0035.html">Configuration Parameters</a>.</li><li id="obs_11_0005__li1517115240588">The <strong id="obs_11_0005__b121971437183911">.obsutilconfig</strong> file contains the AK/SK information, so it is hidden by default to prevent leakage. To query this file, run the following command in the directory where obsutil commands run.<ul id="obs_11_0005__ul1697953825917"><li id="obs_11_0005__li16256183465919">In Windows<pre class="screen" id="obs_11_0005__screen18944803016">dir </pre>
</li><li id="obs_11_0005__li5935164319598">In Linux or macOS<pre class="screen" id="obs_11_0005__screen167813510213">ls -a </pre>
<p id="obs_11_0005__p63978307717">or</p>
<pre class="screen" id="obs_11_0005__screen1264154213717">ls -al</pre>
</li></ul>
</li><li id="obs_11_0005__li189794532099">obsutil encrypts the AK/SK information in the <strong id="obs_11_0005__b81674411613">.obsutilconfig</strong> file.</li></ul>
</div></div>
</div>
<p id="obs_11_0005__p1185854131714">Method 3: Initialize obsutil in interactive mode.</p>
<ul id="obs_11_0005__ul99281545103710"><li id="obs_11_0005__li2265314184418">In Windows<p id="obs_11_0005__p141032044164918"><a name="obs_11_0005__li2265314184418"></a><a name="li2265314184418"></a>Using a permanent AK/SK pair (you do not need to enter a token, and press <strong id="obs_11_0005__b747871310014">Enter</strong> to skip it):</p>
<pre class="screen" id="obs_11_0005__screen215462974415">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!</pre>
<p id="obs_11_0005__p7675101412283">Using a temporary AK/SK pair and a security token:</p>
<pre class="screen" id="obs_11_0005__screen757111052914">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!</pre>
</li><li id="obs_11_0005__li79161684410">In Linux or macOS<p id="obs_11_0005__p5925151115016"><a name="obs_11_0005__li79161684410"></a><a name="li79161684410"></a>Using a permanent AK/SK pair (you do not need to enter a token, and press <strong id="obs_11_0005__b12678229285">Enter</strong> to skip it):</p>
<pre class="screen" id="obs_11_0005__screen630683194413">./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!</pre>
<p id="obs_11_0005__p23760299294">Using a temporary AK/SK pair and a security token:</p>
<pre class="screen" id="obs_11_0005__screen1137617299293">./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!</pre>
</li></ul>
<div class="section" id="obs_11_0005__section1048170135411"><h4 class="sectiontitle">Checking the Connectivity</h4><p id="obs_11_0005__p199015385416">After the initial configuration is complete, run the following command to check the connectivity:</p>
<ul id="obs_11_0005__ul173105390185"><li id="obs_11_0005__li173101239121813">In Windows<pre class="screen" id="obs_11_0005__screen18391205165">obsutil ls -s</pre>
</li><li id="obs_11_0005__li681934171911">In Linux or macOS<pre class="screen" id="obs_11_0005__screen54471715121916">./obsutil ls -s</pre>
</li></ul>
<p id="obs_11_0005__p1452915815368">Check the command output:</p>
<ul id="obs_11_0005__ul157631931518"><li id="obs_11_0005__li376181991519">If it contains "Bucket number", the configuration is correct.</li><li id="obs_11_0005__li10711119141614">If it contains "Http status [403]", the access keys are wrong.</li><li id="obs_11_0005__li19649103911919">If it contains "A connection attempt failed", OBS cannot be connected. Then, check the network condition.</li><li id="obs_11_0005__li13706544314">If it contains "Error: cloud_url [url] is not in well format", the domain name to be accessed is incorrect. Check the domain name in the configuration file.</li></ul>
<div class="note" id="obs_11_0005__note127231141123"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="obs_11_0005__p37231141721">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.</p>
</div></div>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="obs_11_0002.html">Getting Started</a></div>
</div>
</div>