When I run this command
bitcoind -testnet -printtoconsole -rpcuser=123456 -rpcpassword=123456
After bitcoind is up. I run this on the same Ubuntu 17.10
bitcoin-cli -testnet -rpcuser=123456 -rpcpassword=123456 getbalance
I get this result: error: incorrect rpcuser or rpcpassword (authorization failed) The second day I tried exactly the same way. I get the correct result. It is really weird.
I try to put these two lines in /home/user/.bitcoin/bitcoin.conf
And I run this command
bitcoind -testnet -printtoconsole -conf=/home/gogogo237/.bitcoin/bitcoin.conf
bitcoin-cli -testnet -rpcuser=123456 -rpcpassword=1234564 getbalance
notice that I intentionally changed -rpcpassword to a wrong password. But I still can get a correct result. This is really unpredictable and obviously a mistake. Anyone can explain this error? Thanks!