<p>I know how it sounds, but it works now, without any intervention from my side</p>
<p>The only idea I can think of is that the daemon reloads config not immediately but after some time (I did not try full restart after each config change)</p>

CC BY-SA 4.0
2023-09-10T11:38:45.970Z
It does not reload config at all; you need to restart to make new configuration active.
Pieter Wuille
CC BY-SA 4.0
2023-09-10T12:53:25.167Z
@PieterWuille is there any command to force config reload without restarting?
Putnik
CC BY-SA 4.0
2023-09-10T14:40:14.373Z
No, there is not.
Pieter Wuille
CC BY-SA 4.0
2023-09-10T07:43:19.480Z
2023-09-10T07:43:19.480Z
Putnik
<p>The problem: I try to run a <code>curl</code> request but get 401 Unauthorized error.</p>
<pre><code>curl --user testuser --data-binary '{&quot;jsonrpc&quot;: &quot;1.0&quot;, &quot;id&quot;: &quot;curltest&quot;, &quot;method&quot;: &quot;getrawtransaction&quot;, &quot;params&quot;: [&quot;e0cee...47ac5&quot;, true]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ -D -

Enter host password for user 'testuser':
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Basic realm=&quot;jsonrpc&quot;
Date: Sat, 02 Sep 2023 18:12:46 GMT
Content-Length: 0
Content-Type: text/html; charset=ISO-8859-1
</code></pre>
<p>The messages in the debug log of the daemon:</p>
<pre><code>2023-09-02T15:59:44Z ThreadRPCServer incorrect password attempt from 127.0.0.1:36472
</code></pre>
<p>I run <code>bitcoind</code> this way:</p>
<pre><code>/mnt/bitcoin/bin/bitcoind -conf=/mnt/bitcoin/bitcoin.conf
</code></pre>
<p>Also, I have a symlink for this config:</p>
<pre><code>ll ~/.bitcoin/bitcoin.conf
lrwxrwxrwx 1 user user 25 Sep  1 18:42 /home/user/.bitcoin/bitcoin.conf -&gt; /mnt/bitcoin/bitcoin.conf
</code></pre>
<p>Config:</p>
<pre><code>grep -v &quot;#&quot; /mnt/bitcoin/bitcoin.conf | grep -v &quot;^$&quot;                                                                daemon=1
daemonwait=1
...
rest=1
rpcallowip=192.168.0.128/25
rpcallowip=127.0.0.1
rpcauth=testuser:3ad8c2e058a161304a911bcc60c208d2$a364136d41edda037d267e909f9f0355537aefee08b6fd29da2eee59559cf084
server=1
[main]
[test]
[signet]
[regtest]
</code></pre>
<p><code>rpcauth</code> was created this way, and then inserted in the config:</p>
<pre><code>python3 bitcoin/share/rpcauth/rpcauth.py testuser testpasst                                                                                            String to be appended to bitcoin.conf:
rpcauth=testuser:3ad8c2e058a161304a911bcc60c208d2$a364136d41edda037d267e909f9f0355537aefee08b6fd29da2eee59559cf084
Your password:
testpasst
</code></pre>
<p>Also, I tried to replace <code>rpcauth</code> with</p>
<pre><code>rpcuser=testuser
rpcpassword=testpasst
</code></pre>
<p>And did</p>
<pre><code>kill -HUP `cat /mnt/btc_data/bitcoind.pid`
</code></pre>
<p>after every config change (idk wether it's needed or not)</p>
<p>Yes, I have &quot;t&quot; at the end of pass everywhere (I'm too frustrated to re-do all this solely to remove the typo, but the password was copy-pasted many times so I 100% sure there's no mis-type answering curl)</p>
<p>I tried: <a href="https://bitcoin.stackexchange.com/questions/115668/401-unauthorized-connection-using-python-bitcoinrpc">one</a> <a href="https://bitcoin.stackexchange.com/questions/106395/bitcoinrpc-authproxy-jsonrpcexception-342-non-json-http-response-with-401-u">two</a> <a href="https://bitcoin.stackexchange.com/questions/36433/bitcoin-rpc-works-in-bitcoin-cli-but-not-in-python-bitcoinrpc-no-json-object">three</a> <a href="https://bitcoin.stackexchange.com/questions/77214/bitcoin-rpc-returning-401">four</a></p>
<p>What am I doing wrong?</p>

<bitcoin-core><bitcoin-cli>
401 Unauthorized when try to connect to bitcoin-core using curl
Putnik
# 401 Unauthorized when try to connect to bitcoin-core using curl

(Asked by: username_0 on 2023-09-02)

The problem: I try to run a curl request but get 401 Unauthorized error.
curl --user testuser --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "getrawtransaction", "params": ["e0cee...47ac5", true]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ -D -

Enter host password for user 'testuser':
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Basic realm="jsonrpc"
Date: Sat, 02 Sep 2023 18:12:46 GMT
Content-Length: 0
Content-Type: text/html; charset=ISO-8859-1

The messages in the debug log of the daemon:
2023-09-02T15:59:44Z ThreadRPCServer incorrect password attempt from 127.0.0.1:36472

I run bitcoind this way:
/mnt/bitcoin/bin/bitcoind -conf=/mnt/bitcoin/bitcoin.conf

Also, I have a symlink for this config:
ll ~/.bitcoin/bitcoin.conf
lrwxrwxrwx 1 user user 25 Sep  1 18:42 /home/user/.bitcoin/bitcoin.conf -> /mnt/bitcoin/bitcoin.conf

Config:
grep -v "#" /mnt/bitcoin/bitcoin.conf | grep -v "^$"                                                                daemon=1
daemonwait=1
...
rest=1
rpcallowip=192.168.0.128/25
rpcallowip=127.0.0.1
rpcauth=testuser:3ad8c2e058a161304a911bcc60c208d2$a364136d41edda037d267e909f9f0355537aefee08b6fd29da2eee59559cf084
server=1
[main]
[test]
[signet]
[regtest]

rpcauth was created this way, and then inserted in the config:
python3 bitcoin/share/rpcauth/rpcauth.py testuser testpasst                                                                                            String to be appended to bitcoin.conf:
rpcauth=testuser:3ad8c2e058a161304a911bcc60c208d2$a364136d41edda037d267e909f9f0355537aefee08b6fd29da2eee59559cf084
Your password:
testpasst

Also, I tried to replace rpcauth with
rpcuser=testuser
rpcpassword=testpasst

And did
kill -HUP `cat /mnt/btc_data/bitcoind.pid`

after every config change (idk wether it's needed or not)
Yes, I have "t" at the end of pass everywhere (I'm too frustrated to re-do all this solely to remove the typo, but the password was copy-pasted many times so I 100% sure there's no mis-type answering curl)
I tried: one two three four
What am I doing wrong?

**Tags:** bitcoin-core, bitcoin-cli


---

## 1 answers

### Answer by username_0 on 2023-09-10. Score: 0 | Accepted answer

I know how it sounds, but it works now, without any intervention from my side

The only idea I can think of is that the daemon reloads config not immediately but after some time (I did not try full restart after each config change)

> **Comments:**
> **username_1**: It does not reload config at all; you need to restart to make new configuration active.  
> **username_0**: @PieterWuille is there any command to force config reload without restarting?  
> **username_1**: No, there is not.  

---

