bitcoin-cli fails with auth error

3

1

I run it like the below.

bitcoind -datadir=/Users/varunvb/Downloads -conf=/Users/varunvb/Downloads/bitcoin.conf -daemon

When I run (Using the user name and password as in the config file)

bitcoin-cli -rpcuser=<USER> -rpcpassword=<PWD> getinfo

I get error: incorrect rpcuser or rpcpassword (authorization failed)

I see the below in the debug log

ThreadRPCServer incorrect password attempt from 127.0.0.1

My bitcoin.conf file looks like this:

-e
rpcuser=<USER>
rpcpassword=<PWD>

Ani

Posted 2015-01-12T16:26:18.243

Reputation: 31

What are the contents of bitcoin.conf? Is there another bitcoin-core instance running at the same time on the same machine?George Kimionis 2015-01-12T16:38:58.763

Thanks David for replying! The content inside config file is as below -e rpcuser=<USER> rpcpassword=<PWD> that's it. And no there're no other instances running apart from bitcoind i showed in the questionAni 2015-01-12T16:59:22.090

Remove that -e before rpcuser. Please consult this sample configuration.

George Kimionis 2015-01-12T17:04:39.987

bitcoin-cli can read rpcuser and rpcpassword out of your config file. Just pass -conf=/Users/varunvb/Downloads/bitcoin.conf to bitcoin-cli.Nick ODell 2015-01-12T17:13:05.963

@NickODell has a point. Just call bitcoin-cli -conf=/Users/varunvb/Downloads/bitcoin.conf -datadir=/Users/varunvb/Downloads getinfo and that should be it.George Kimionis 2015-01-12T17:43:27.247

@GeorgeKimionis removing -e form the config worked! Thanks!Ani 2015-01-12T18:45:54.923

@NickODell I supply the directory as a command line parameter and it works fine. Thanks!Ani 2015-01-12T18:46:10.400

Answers

4

bitcoin-cli can read rpcuser and rpcpassword out of your config file. Just run it like this:

bitcoin-cli -conf=/Users/varunvb/Downloads/bitcoin.conf -datadir=/Users/varunvb/Downloads getinfo

Also, remove the -e from your bitcoin.conf.

Nick ODell

Posted 2015-01-12T16:26:18.243

Reputation: 26 536