</script><metaname="aes-config"content="pid=xux-opensource&user_type=101&uid=&username=&dim10=arthas"><scriptsrc="//g.alicdn.com/alilog/mlog/aplus_v2.js"id="beacon-aplus"exparams="clog=o&aplus&sidx=aplusSidx&ckx=aplusCkx"></script><scriptsrc="//g.alicdn.com/aes/??tracker/1.0.34/index.js,tracker-plugin-pv/2.4.5/index.js,tracker-plugin-event/1.2.5/index.js,tracker-plugin-jserror/1.0.13/index.js,tracker-plugin-api/1.1.14/index.js,tracker-plugin-perf/1.1.8/index.js,tracker-plugin-eventTiming/1.0.4/index.js"></script><title>auth | arthas</title><metaname="description"content="arthas user document">
</code></pre><divclass="line-numbers"aria-hidden="true"><divclass="line-number"></div></div></div><ul><li><p>The user can be specified by the <code>--username</code> option, the default value is <code>arthas</code>.</p></li><li><p>You can also configure username/password in <code>arthas.properties</code>. The priority of the command line is higher than that of the configuration file.</p></li><li><p>If only <code>username</code> is configured and no <code>password</code> is configured, a random password will be generated and printed in <code>~/logs/arthas/arthas.log</code></p><divclass="language-text ext-text line-numbers-mode"><preclass="language-text"><code>Using generated security password: 0vUBJpRIppkKuZ7dYzYqOKtranj4unGh
</code></pre><divclass="line-numbers"aria-hidden="true"><divclass="line-number"></div></div></div></li></ul><h2id="local-connection-does-not-require-authentication"tabindex="-1"><aclass="header-anchor"href="#local-connection-does-not-require-authentication"aria-hidden="true">#</a> Local connection does not require authentication</h2><p>By default, there are configurations in the <code>arthas.properties</code> file:</p><divclass="language-text ext-text line-numbers-mode"><preclass="language-text"><code>arthas.localConnectionNonAuth=true
</code></pre><divclass="line-numbers"aria-hidden="true"><divclass="line-number"></div></div></div><p>When the password is configured, connect from localhost, the authentication is not required. The default configuration value is true, which is convenient for local connection. Authentication is only required when connecting remotely.</p><h2id="authenticate-in-the-telnet-console"tabindex="-1"><aclass="header-anchor"href="#authenticate-in-the-telnet-console"aria-hidden="true">#</a> Authenticate in the telnet console</h2><p>After connecting to arthas, directly executing the command will prompt for authentication:</p><divclass="language-bash ext-sh line-numbers-mode"><preclass="language-bash"><code><spanclass="token punctuation">[</span>arthas@37430<spanclass="token punctuation">]</span>$ <spanclass="token builtin class-name">help</span>
Error<spanclass="token operator">!</span><spanclass="token builtin class-name">command</span> not permitted, try to use <spanclass="token string">'auth'</span><spanclass="token builtin class-name">command</span> to authenticates.
</code></pre><divclass="line-numbers"aria-hidden="true"><divclass="line-number"></div><divclass="line-number"></div></div></div><p>Use the <code>auth</code> command to authenticate, and you can execute other commands after success.</p><divclass="language-text ext-text line-numbers-mode"><preclass="language-text"><code>[arthas@37430]$ auth ppp
</code></pre><divclass="line-numbers"aria-hidden="true"><divclass="line-number"></div><divclass="line-number"></div></div></div><ul><li>The user can be specified by the <code>--username</code> option, the default value is <code>arthas</code>.</li></ul><h2id="web-console-authentication"tabindex="-1"><aclass="header-anchor"href="#web-console-authentication"aria-hidden="true">#</a> Web console Authentication</h2><p>Open the browser, there will be a pop-up window prompting you to enter your username and password.</p><p>After success, you can directly connect to the web console.</p><h2id="http-api-authentication"tabindex="-1"><aclass="header-anchor"href="#http-api-authentication"aria-hidden="true">#</a> HTTP API Authentication</h2><h3id="http-authorization-header-recommended"tabindex="-1"><aclass="header-anchor"href="#http-authorization-header-recommended"aria-hidden="true">#</a> HTTP Authorization Header(recommended)</h3><p>Arthas uses the HTTP standard Basic Authorization.</p><ul><li>Reference: <ahref="https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication"target="_blank"rel="noopener noreferrer">https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication<span><svgclass="external-link-icon"xmlns="http://www.w3.org/2000/svg"aria-hidden="true"focusable="false"x="0px"y="0px"viewbox="0 0 100 100"width="15"height="15"><pathfill="currentColor"d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygonfill="currentColor"points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><spanclass="external-link-icon-sr-only">open in new window</span></span></a></li></ul><p>For example, if the user name is: <code>admin</code> and the password is <code>admin</code>, the combination is a string: <code>admin:admin</code>, the base64 result is: <code>YWRtaW46YWRtaW4=</code>, then the HTTP request adds the <code>Authorization</code> header:</p><divclass="language-bash ext-sh line-numbers-mode"><preclass="language-bash"><code><spanclass="token function">curl</span><spanclass="token string">'http://localhost:8563/api'</span><spanclass="token punctuation">\</span>