<p>When you don't explicitly specify any RPC credentials, bitcoind will autogenerate them for you and store the password in the <code>$DATADIR/.cookie</code> file.</p>

<p>You can then use the username <code>__cookie__</code> along with the password from that file.</p>

CC BY-SA 4.0
2019-11-03T17:11:06.337Z
Note that the contents of that file will change every time you restart Bitcoin Core. If you have a need for accessing your bitcoind in any setting other than the local user with bitcoin-cli, you should really create a bitcoin.conf file with a static username/password (look up rpcauth).
Pieter Wuille
CC BY-SA 4.0
2019-11-03T07:33:01.810Z
2019-11-03T07:33:01.810Z
Raghav Sood
<p>So I am in the process of downloading the blocks after installing bitcoin on my ubuntu server. I have followed the guide on <a href="https://bitcoin.org/en/full-node" rel="nofollow noreferrer">https://bitcoin.org/en/full-node</a>.</p>

<p>Everything is working correctly. Blocks are downloading just fine to ~/.bitcoin/blocks. bitcoin-cli commands are working without error. </p>

<p>If I switch users and I try to issue a bitcoin-cli command naturally I get <code>"Could not locate RPC credentials. No authentication cookie could be found, and RPC password is not set."</code></p>

<p>However when using the correct user where cli commands do work, there is still no bitcoin.conf file inside ~/.bitcoin/ As the node is downloading the blocks and the cli commands work I assume there must be a conf file - yet its not where every single document and support answer claims it will be. </p>

<p>I have tried <code>find . -name "bitcoin.conf"</code> in the ~/.bitcoin directory as well as user ~/ and in /etc all return empty. Where else could this file possibly hide? If it doesn't exists why would I still be downloading blocks and able to issue cli commands?</p>

<p>I am aware this question has been asked countless times but i cant find any answers relating to the fact the node is working and cli commands are working. </p>

CC BY-SA 4.0
2019-11-03T06:49:13.633Z
With the user where bitcoin-cli does work, you can try running `strace bitcoin-cli getblockchaininfo` and read the output to see which path it is reading `bitcoin.conf` from. For example, I can see `openat(AT_FDCWD, "/home/ubuntu/.bitcoin/bitcoin.conf", O_RDONLY) = 3` in my local output.
Raghav Sood
CC BY-SA 4.0
2019-11-03T07:01:40.270Z
well now i am super confused as that returns `open("/home/admin/.bitcoin/bitcoin.conf", O_RDONLY) = -1 ENOENT (No such file or directory)` and yet i can still issue commands like `bitcoin-cli getnetworkhashps` and `bitcoin-cli getblockchaininfo` without any errors.
Bruce
CC BY-SA 4.0
2019-11-03T07:23:47.387Z
Do you have a `/home/admin/.bitcoin/.cookie` file?
Raghav Sood
CC BY-SA 4.0
2019-11-03T07:29:22.950Z
yes i do have ha file, i has a single line in it
Bruce
<bitcoin-core><bitcoind><bitcoin-cli>
My first full node - no bitcoin.conf
Bruce
# My first full node - no bitcoin.conf

(Asked by: username_0 on 2019-11-03)

So I am in the process of downloading the blocks after installing bitcoin on my ubuntu server. I have followed the guide on <https://bitcoin.org/en/full-node>.

Everything is working correctly. Blocks are downloading just fine to ~/.bitcoin/blocks. bitcoin-cli commands are working without error.

If I switch users and I try to issue a bitcoin-cli command naturally I get `"Could not locate RPC credentials. No authentication cookie could be found, and RPC password is not set."`

However when using the correct user where cli commands do work, there is still no bitcoin.conf file inside ~/.bitcoin/ As the node is downloading the blocks and the cli commands work I assume there must be a conf file - yet its not where every single document and support answer claims it will be.

I have tried `find . -name "bitcoin.conf"` in the ~/.bitcoin directory as well as user ~/ and in /etc all return empty. Where else could this file possibly hide? If it doesn't exists why would I still be downloading blocks and able to issue cli commands?

I am aware this question has been asked countless times but i cant find any answers relating to the fact the node is working and cli commands are working.

**Tags:** bitcoin-core, bitcoind, bitcoin-cli

> **Comments:**
> **username_1**: With the user where bitcoin-cli does work, you can try running `strace bitcoin-cli getblockchaininfo` and read the output to see which path it is reading `bitcoin.conf` from. For example, I can see `openat(AT_FDCWD, "/home/ubuntu/.bitcoin/bitcoin.conf", O_RDONLY) = 3` in my local output.  
> **username_0**: well now i am super confused as that returns `open("/home/admin/.bitcoin/bitcoin.conf", O_RDONLY) = -1 ENOENT (No such file or directory)` and yet i can still issue commands like `bitcoin-cli getnetworkhashps` and `bitcoin-cli getblockchaininfo` without any errors.  
> **username_1**: Do you have a `/home/admin/.bitcoin/.cookie` file?  
> **username_0**: yes i do have ha file, i has a single line in it  

---

## 1 answers

### Answer by username_1 on 2019-11-03. Score: 4 | Accepted answer

When you don't explicitly specify any RPC credentials, bitcoind will autogenerate them for you and store the password in the `$DATADIR/.cookie` file.

You can then use the username `__cookie__` along with the password from that file.

> **Comments:**
> **username_2**: Note that the contents of that file will change every time you restart Bitcoin Core. If you have a need for accessing your bitcoind in any setting other than the local user with bitcoin-cli, you should really create a bitcoin.conf file with a static username/password (look up rpcauth).  

---

