I asked this question on AskUbuntu and was told to post it here.


I am trying to follow the Mastering Bitcoin tutorial. After compiling Bitcoin Core, and changing the datadir to my external hard drive in the config file, I get the following error any time I try a Bitcoin-cli command:

error: Could not locate RPC credentials. No authentication cookie could be found, and RPC password is not set. See -rpcpassword and -stdinrpcpass. Configuration file: (/media/XXXX/f1ebcea0-6304-4580-9ce2-1416dc0be49f/BlockchainData/bitcoin.conf)

When I search the forums, the only solution to this error is that Bitcoind was not running, but I confirmed that it is running. I suspect it has something to do with my hard drive permissions or admin level, but everything seems to be set up properly.

  • Share your complete bitcoin.conf file contents assuming you are trying this on testnet, else share relevant things from config file
    – user103136
    Nov 5, 2021 at 19:18
  • datadir=/media/XXXX/f1ebcea0-6304-4580-9ce2-1416dc0be49f/BlockchainData is the only thing i have in it
    – JC43
    Nov 5, 2021 at 20:01
  • Save this in bitcoin.conf apart from datadir: rpcport=8332 rpcuser=SOMEUSERNAME rpcpassword=SOMEPASS and use bitcoin-cli datadir=/media/XXXX/f1ebcea0-6304-4580-9ce2-1416dc0be49f/BlockchainData -getinfo
    – user103136
    Nov 5, 2021 at 21:37
  • This did not solve the issue. I resorted to re-formatting my drive and got a larger home drive. Thank you for the help though.
    – JC43
    Feb 2, 2022 at 1:57

1 Answer 1


Since you are probably starting the daemon with a non-standard data directory, you'll need to specify the datadir every time you use the bitcoin-cli command, like this:

bitcoin-cli -datadir=/mnt/bitcoin YOUR_COMMMAND

Source: https://howchoo.com/bitcoin/run-bitcoin-full-node-raspberry-pi

  • I already re-formatted my hard drive, thank you for the help though
    – JC43
    Feb 2, 2022 at 1:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.