<p>I was having the same problem and just managed to fix it now.
Since the file bitcoin.conf does not exist inside ~/.bitcoin, Just create one.</p>

<p>Here's what did:</p>

<pre><code> vi ~/.bitcoin/bitcoin.conf
</code></pre>

<p>Enter letter 'a' (to edit the file). Then type:</p>

<pre><code> rpcpassword=any_long_random_password
</code></pre>

<p>Press the ESC key, and press ZZ to exit vi</p>

<p>Apparently the password that bitcoind started with is (for one reason or the other) different from the one you are trying. (i also have a feeling that bitcoind misbehaves like that because no password was defined; since there was no bitcoin.conf)</p>

<p>Now, even though you have changed the password, it will NOT be effective until bitcoind has been re-started. But since it won't even accept the stop command (./bitcoin-cli stop) due to the authentication issue;
You will need to kill the process, and restart bitcoind. It will work fine afterwards:</p>

<pre><code>pkill -9 -f bitcoind
</code></pre>

<p>then</p>

<pre><code>./bitcoind -daemon
</code></pre>

<p>Hope this is helpful</p>

CC BY-SA 3.0
2016-09-22T11:36:31.037Z
2016-09-22T11:36:31.037Z
tormuto
<p>I started <code>bitcoind -datadir=/mnt/btc</code> but everytime I try to use <code>bitcoin-cli</code> it says :</p>

<blockquote>
  <p>error : incorrect rpcuser or rpcpassword (authorization failed)</p>
</blockquote>

<p>I can't find bitcoin.conf (neither in the default datadir <code>~/.bitcoin</code> neither in /mnt/btc).</p>

<p>Any idea how I can generate one and if it will help the original problem ?</p>

<bitcoind><json-rpc><authentication>
error : incorrect rpcuser or rpcpassword (authorization failed)
ChiseledAbs
# error : incorrect rpcuser or rpcpassword (authorization failed)

(Asked by: username_0 on 2016-08-05)

I started `bitcoind -datadir=/mnt/btc` but everytime I try to use `bitcoin-cli` it says :

> error : incorrect rpcuser or rpcpassword (authorization failed)

I can't find bitcoin.conf (neither in the default datadir `~/.bitcoin` neither in /mnt/btc).

Any idea how I can generate one and if it will help the original problem ?

**Tags:** bitcoind, json-rpc, authentication


---

## 1 answers

### Answer by username_1 on 2016-09-22. Score: 13

I was having the same problem and just managed to fix it now.
Since the file bitcoin.conf does not exist inside ~/.bitcoin, Just create one.

Here's what did:

```
 vi ~/.bitcoin/bitcoin.conf

```

Enter letter 'a' (to edit the file). Then type:

```
 rpcpassword=any_long_random_password

```

Press the ESC key, and press ZZ to exit vi

Apparently the password that bitcoind started with is (for one reason or the other) different from the one you are trying. (i also have a feeling that bitcoind misbehaves like that because no password was defined; since there was no bitcoin.conf)

Now, even though you have changed the password, it will NOT be effective until bitcoind has been re-started. But since it won't even accept the stop command (./bitcoin-cli stop) due to the authentication issue;
You will need to kill the process, and restart bitcoind. It will work fine afterwards:

```
pkill -9 -f bitcoind

```

then

```
./bitcoind -daemon

```

Hope this is helpful


---

