bitcoind: incorrect rpcuser or rpcpassword (authorization failed) The host system is Linux Debian Stretch (9 / testing).

The Bitcoin Core package for Linux I have just downloaded and verified and installed.

I have created the following file:

/home/myUsername/.bitcoin/bitcoin.conf


With contents:

listen=1
server=1
rpcuser=myUsername
rpcpassword=myPassword
rpcport=8332
rpcconnect=127.0.0.1


Then I have punched the following holes to my firewall:

sudo iptables -A INPUT -p tcp -m tcp --dport 8333 -m comment --comment "Bitcoin Listen" -j ACCEPT

sudo iptables -A INPUT -p tcp -m tcp --dport 8332 -m comment --comment "Bitcoin RPC" -j ACCEPT


And forwarded the 8333 port from my router to the server.

I am unsure whether the second hole is necessary for RPC connections, but that's not the question now.



If I now run the following command as my regular user:

bitcoind -daemon -datadir=/raid1a/bitcoind/


It says:


Bitcoin server starting



I wait for a few minutes for it to initialize and then invoke:

bitcoin-cli getinfo


With the result:


error: incorrect rpcuser or rpcpassword (authorization failed)



I have a very long and complex password, could that be the pickle?

The debug log says only:


ThreadRPCServer incorrect password attempt from 127.0.0.1:someport
Despite I run both bitcoind and bitcoin-cli as the same user, it for some reason fails to find my personal config file located in standard location:

$HOME/.bitcoin/bitcoin.conf


So I have set up an alias:

bitcoind -daemon -datadir=/raid1a/bitcoind/ -conf=/home/user/.bitcoin/bitcoin.conf


Case solved.