Bitcoind running on external HDD trying to resolve cookie from default datadir On Elementary OS Loki 0.4.1 I've downloaded and installed bitcoind as per the official guide from bitcoin.org .

However, I in my case I don't have enough space on my internal SSD to store the whole blockchain, so I want to download it and maintain it on an external hooked up HDD. 

When I run the bitcoind -daemon -datadir=path_to_external_hdd_folder the Bitcoin server starts up successfully and starts downloading the blockchain to that specified folder (In the logs I can see the height is growing and so is the size of the selected datadir which I passed in as an argument) 

My problem is - when I try to run commands by running bitcoin-cli getblockchaininfo for example, I get the error:

error: Could not locate RPC credentials. No authentication cookie could be found, and no rpcpassword is set in the configuration file (/home/martin/.bitcoin/bitcoin.conf)


What's weird is that when I move the .cookie file from my external drive to /home/martin/.bitcoin/bitcoin.conf the commands start working. 

This is a temporary solution though, I wouldn't like to move that file everytime I startup the bitcoin server. 

Do I maybe need to pass in an extra argument to bitcoind -daemon?

I've tried passing -rpccookiefile=path_to_cookie_file_on_External_hdd to it but that didn't work.

Note: My bitcoin.conf file is empty. 

UPDATE 1
I tried setting -conf when starting bitcoind but that didn't work either.
You need to pass the same -datadir option to bitcoin-cli as to bitcoind. This will enable it to find the cookie file, but also potential other relevant changes you could have made to bitcoin.conf like rpcport. (I know you haven't, but this approach is compatible with those).