Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: BlackHatCoiner on April 29, 2021, 05:02:43 PM



Title: Authorization failed: Incorrect rpcuser or rpcpassword
Post by: BlackHatCoiner on April 29, 2021, 05:02:43 PM
For some reason, once I enter the following command on the terminal I get this error:
Code:
angelo@angelopc:~/Desktop/bitcoin/bin$ ./bitcoin-cli --testnet --rpcuser=test123456 --rpcpassword=123456 --netinfo
error: Authorization failed: Incorrect rpcuser or rpcpassword

The thing is that these are the correct credentials, I haven't made any mistakes. Here's my bitcoin.conf:
Code:
server=1
listen=1
daemon=1
txindex=1
rpcuser=test123456
rpcpassword=123456

What is going on? FYI, the configuration file is located on an external drive, while the binaries of Bitcoin Core are on my internal SSD.


Title: Re: Authorization failed: Incorrect rpcuser or rpcpassword
Post by: NotATether on April 29, 2021, 05:15:13 PM
If you use the password in the .cookie file instead of writing your password on the command line, and remove the rpcuser and rpcpassword entries from your bitcoin.conf, does it work then?

Some other useful information:

The problem is that bitcoind uses the cookie not the password from the config.

I put a std::cout in RPCAuthorized() in httprpc.cpp
std::cout << strUserPass << "\n" << strRPCUserColonPass<<"\n";

The output is:

REPLACED:REPLACED
__cookie__:0723ef24069e50123146dca0d76488bb0583781fc55e254b78be93eaf2764745


Title: Re: Authorization failed: Incorrect rpcuser or rpcpassword
Post by: BlackHatCoiner on April 29, 2021, 05:26:14 PM
If you use the password in the .cookie file instead of writing your password on the command line

Use it where and how?


Title: Re: Authorization failed: Incorrect rpcuser or rpcpassword
Post by: NotATether on April 29, 2021, 06:10:19 PM
If you use the password in the .cookie file instead of writing your password on the command line

Use it where and how?

Instead of --rpcuser=test123456 --rpcpassword=123456, write --rpcuser=__cookie__ --rpcpassword=<long hex string inside the .cookie file> and remove the stuff from your config file since the .cookie file is autogenerated at runtime.


Title: Re: Authorization failed: Incorrect rpcuser or rpcpassword
Post by: BlackHatCoiner on April 29, 2021, 06:24:24 PM
Instead of --rpcuser=test123456 --rpcpassword=123456, write --rpcuser=__cookie__ --rpcpassword=<long hex string inside the .cookie file> and remove the stuff from your config file since the .cookie file is autogenerated at runtime.

Yes, it works! Thank you.


Title: Re: Authorization failed: Incorrect rpcuser or rpcpassword
Post by: gmaxwell on April 30, 2021, 02:58:06 AM
Your bitcoin.conf configured rpcpassword likely had non-permitted characters (such as #) and so it was getting ignored.