<p>maybe it works when you change
rpcallowip=*
to
rpcallowip=127.0.0.1</p>

CC BY-SA 4.0
2021-07-27T22:04:26.620Z
2021-07-27T22:04:26.620Z
Jonas Bellaert
<p>I found I had to copy the contents of <code>~/.bitcoin/bitcoin.conf</code> into <code>/etc/bitcoin/bitcoin.conf</code> because that's what's being used when bitcoind starts on boot up. I put my user and password in that file, rebooted, and <code>bitcoin-cli</code> worked again.</p>

<p>Also try adding</p>

<pre><code>bitcoin-cli -stdinrpcpass getblockchaininfo -rpcuser user -rpcpassword password
</code></pre>

CC BY-SA 4.0
2019-03-09T16:57:43.630Z
Also strange thing, when i trying for exaple to change rcp port by bitcoin-cli -rpcport 8332, it's like setting to 0 and returns "Could not connect to the server 127.0.0.1:0"
Nicklessguy
CC BY-SA 4.0
2019-03-09T17:31:31.803Z
Do you want to run testnet or mainnet? 18332 is the testnet port. 8332 is mainnet. You have `testnet=0` which maybe should be `testnet=1`?
MikeHelland
CC BY-SA 4.0
2019-03-09T17:43:22.463Z
first of all i tried testnet, but it didn't work the same. You know, i solved the problem, but with not finally correct method. I used command: bitcoind --daemon -rpcuser=user -rpcpassword=password -txindex -rpcallowip=127.0.0.1 -rpcallowip=185.50.25.17 -rpcport=8332. It works, but i don't think this method is ok.
Nicklessguy
CC BY-SA 4.0
2019-03-09T16:30:14.353Z
2019-03-09T16:30:14.353Z
MikeHelland
<p>I installed bitoind and synced it. But when i'm trying to connect from my php website i getting: 
Unable to connect to <a href="http://user:password@my.bitoind.server.ip:18332/" rel="nofollow noreferrer">http://user:password@my.bitoind.server.ip:18332/</a>. 
Also when i'm trying to see password through command</p>

<p><code>bitcoin-cli -stdinrpcpass getblockchaininfo</code> </p>

<p>it returns </p>

<p><code>could not locate RPC credentials. No authentication cookie could be found, and RPC password is not set.  See -rpcpassword and -stdinrpcpass.  Configuration file: (/blockchain/.bitcoin/bitcoin.conf)</code>. </p>

<p>My bitcoin.conf file is setted and works nice</p>

<pre><code>rpcuser=USER
rpcpassword=PASS
testnet=0
daemon=1
rpcport=18332
rpcallowip=*
server=1
datadir=/blockchain/.bitcoin
txindex=1
</code></pre>

<bitcoin-core><bitcoind><json-rpc><authentication>
Bitcoind could not locate RPC credentials but rpcuser and password are set
Nicklessguy
# Bitcoind could not locate RPC credentials but rpcuser and password are set

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

I installed bitoind and synced it. But when i'm trying to connect from my php website i getting:
Unable to connect to <http://user:password@my.bitoind.server.ip:18332/>.
Also when i'm trying to see password through command

`bitcoin-cli -stdinrpcpass getblockchaininfo`

it returns

`could not locate RPC credentials. No authentication cookie could be found, and RPC password is not set. See -rpcpassword and -stdinrpcpass. Configuration file: (/blockchain/.bitcoin/bitcoin.conf)`.

My bitcoin.conf file is setted and works nice

```
rpcuser=USER
rpcpassword=PASS
testnet=0
daemon=1
rpcport=18332
rpcallowip=*
server=1
datadir=/blockchain/.bitcoin
txindex=1

```

**Tags:** bitcoin-core, bitcoind, json-rpc, authentication


---

## 2 answers

### Answer by username_1 on 2021-07-27. Score: 0

maybe it works when you change
rpcallowip=\*
to
rpcallowip=127.0.0.1


---

### Answer by username_2 on 2019-03-09. Score: 0

I found I had to copy the contents of `~/.bitcoin/bitcoin.conf` into `/etc/bitcoin/bitcoin.conf` because that's what's being used when bitcoind starts on boot up. I put my user and password in that file, rebooted, and `bitcoin-cli` worked again.

Also try adding

```
bitcoin-cli -stdinrpcpass getblockchaininfo -rpcuser user -rpcpassword password

```

> **Comments:**
> **username_0**: Also strange thing, when i trying for exaple to change rcp port by bitcoin-cli -rpcport 8332, it's like setting to 0 and returns "Could not connect to the server 127.0.0.1:0"  
> **username_2**: Do you want to run testnet or mainnet? 18332 is the testnet port. 8332 is mainnet. You have `testnet=0` which maybe should be `testnet=1`?  
> **username_0**: first of all i tried testnet, but it didn't work the same. You know, i solved the problem, but with not finally correct method. I used command: bitcoind --daemon -rpcuser=user -rpcpassword=password -txindex -rpcallowip=127.0.0.1 -rpcallowip=185.50.25.17 -rpcport=8332. It works, but i don't think this method is ok.  

---

