<p>I'm new to Bitcoin development and I'm currently having <strong>difficulties trying to make RPC calls to a Bitcoin-Core daemon running in a SSH server</strong>. I suppose that the problem is with Firewall or closed ports, but I also do not know much about Network settings.</p>

<p>I'm using <strong>nbobtc/bitcoind-php package</strong> to make the RPC calls with HTTP requests, and it is running in a Docker container. I'm sure this is working and is not the problem.</p>

<p>So here's what happening: when I run bitcoind <strong>in a normal user</strong> in my SSH server, and using nbobtc package to make the RPC calls, the connection always get refused in port 18332 (that is conffirmed when I try to telnet that port in SSH's ip address):</p>

<blockquote>
  <p>Failed to connect to 192.168.xx.xxx port 18332: Connection refused</p>
</blockquote>

<p>However, when I run bitcoind in super user (root), the RPC calls works just perfectly. But as I did not want to run bitcoind in root user, I'd like to find out what may be blocking me from making RPC calls to a normal user - or if is it even possible.</p>

<p>I've tried to open ports with 'sudo ufw allow 18332' and also with IPTABLES (but actually I'm not sure which one is being used by the SSH - it wasn't me who configured it). I'm not sure if they have worked as with nc and telnet commands connection is still being refused.</p>

<p>Here's what my bitcoin.conf looks like (I want to use testnet in here):</p>

<pre><code>server=1
debug=net
txindex=1
testnet=1
rpcuser=userb
rpcpassword=test
test.rpcport=18332

# I've already tried allowing the IP these 3 ways:
# rpcallowip=192.168.xx.xx  # My machine's IP
# rpcallowip=172.19.x.x/xx  # Docker's NBOBTC container IP
# rpcallowip=0.0.0.0/0      # Allowing all IP

datadir=/home/bitcoin-dev/.bitcoin
debuglogfile=/home/bitcoin-dev/.bitcoin/debug.log
</code></pre>

<p>PS: I'm using Bitcoin-Core "subversion": "Satoshi:0.17.1"</p>

<p>Here's what appears in debug.log right after I run Bitcoind:</p>

<pre><code>2019-05-06T14:43:10Z Bitcoin Core version v0.17.1 (release build)
2019-05-06T14:43:10Z InitParameterInteraction: parameter interaction: -whitelistforcerelay=1 -&gt; setting -whitelistrelay=1
2019-05-06T14:43:10Z Assuming ancestors of block 0000000000000037a8cd3e06cd5edbfe9dd1dbcc5dacab279376ef7cfc2b4c75 have valid signatures.
2019-05-06T14:43:10Z Setting nMinimumChainWork=00000000000000000000000000000000000000000000007dbe94253893cbd463
2019-05-06T14:43:10Z Using the 'sse4(1way),sse41(4way)' SHA256 implementation
2019-05-06T14:43:10Z Default data directory /root/.bitcoin
2019-05-06T14:43:10Z Using data directory /home/bitcoin-dev/.bitcoin/testnet3
2019-05-06T14:43:10Z Using config file /home/bitcoin-dev/.bitcoin/bitcoin.conf
2019-05-06T14:43:10Z Using at most 125 automatic connections (1024 file descriptors available)
2019-05-06T14:43:10Z Using 16 MiB out of 32/2 requested for signature cache, able to store 524288 elements
2019-05-06T14:43:10Z Using 16 MiB out of 32/2 requested for script execution cache, able to store 524288 elements
2019-05-06T14:43:10Z Using 4 threads for script verification
2019-05-06T14:43:10Z scheduler thread start
2019-05-06T14:43:10Z Binding RPC on address 0.0.0.0 port 18332 failed.
2019-05-06T14:43:10Z HTTP: creating work queue of depth 16
2019-05-06T14:43:10Z Config options rpcuser and rpcpassword will soon be deprecated. Locally-run instances may remove rpcuser to use cookie-based auth, or may be replaced with rpcauth. Please see share/rpcauth for rpcauth auth generation.
2019-05-06T14:43:10Z HTTP: starting 4 worker threads
2019-05-06T14:43:10Z Using wallet directory /home/bitcoin-dev/.bitcoin/testnet3/wallets
2019-05-06T14:43:10Z init message: Verifying wallet(s)...
2019-05-06T14:43:10Z Using BerkeleyDB version Berkeley DB 4.8.30: (April  9, 2010)
2019-05-06T14:43:10Z Using wallet wallet.dat
2019-05-06T14:43:10Z BerkeleyEnvironment::Open: LogDir=/home/bitcoin-dev/.bitcoin/testnet3/wallets/database ErrorFile=/home/bitcoin-dev/.bitcoin/testnet3/wallets/db.log
2019-05-06T14:43:10Z net: setting try another outbound peer=false
2019-05-06T14:43:10Z Cache configuration:
2019-05-06T14:43:10Z * Using 2.0MiB for block index database
2019-05-06T14:43:10Z * Using 56.0MiB for transaction index database
2019-05-06T14:43:10Z * Using 8.0MiB for chain state database
2019-05-06T14:43:10Z * Using 384.0MiB for in-memory UTXO set (plus up to 286.1MiB of unused mempool space)
2019-05-06T14:43:10Z init message: Loading block index...
2019-05-06T14:43:10Z Opening LevelDB in /home/bitcoin-dev/.bitcoin/testnet3/blocks/index
2019-05-06T14:43:10Z Opened LevelDB successfully
2019-05-06T14:43:10Z Using obfuscation key for /home/bitcoin-dev/.bitcoin/testnet3/blocks/index: 0000000000000000
2019-05-06T14:43:19Z LoadBlockIndexDB: last block file = 161
2019-05-06T14:43:19Z LoadBlockIndexDB: last block file info: CBlockFileInfo(blocks=755, size=30875345, heights=1513309...1514061, time=2019-04-29...2019-05-03)
2019-05-06T14:43:19Z Checking all blk files are present...
2019-05-06T14:43:20Z Opening LevelDB in /home/bitcoin-dev/.bitcoin/testnet3/chainstate
2019-05-06T14:43:20Z Opened LevelDB successfully
2019-05-06T14:43:20Z Using obfuscation key for /home/bitcoin-dev/.bitcoin/testnet3/chainstate: 2686d59caeb1917c
2019-05-06T14:43:20Z Loaded best chain: hashBestChain=00000000b3b6a5db140b6058b7abe5cb00d8af61afd2a237ae3468cd36e387fa height=927391 date=2016-09-08T15:04:00Z progress=0.311180
2019-05-06T14:43:20Z init message: Rewinding blocks...
2019-05-06T14:43:29Z init message: Verifying blocks...
2019-05-06T14:43:29Z Verifying last 6 blocks at level 3
2019-05-06T14:43:29Z [0%]...[16%]...[33%]...[50%]...[66%]...[83%]...[99%]...[DONE].
2019-05-06T14:43:29Z No coin database inconsistencies in last 6 blocks (500 transactions)
2019-05-06T14:43:29Z  block index           19450ms
2019-05-06T14:43:29Z Opening LevelDB in /home/bitcoin-dev/.bitcoin/testnet3/indexes/txindex
2019-05-06T14:43:30Z Opened LevelDB successfully
2019-05-06T14:43:30Z Using obfuscation key for /home/bitcoin-dev/.bitcoin/testnet3/indexes/txindex: 0000000000000000
2019-05-06T14:43:30Z init message: Loading wallet...
2019-05-06T14:43:30Z txindex thread start
2019-05-06T14:43:30Z [default wallet] nFileVersion = 170100
2019-05-06T14:43:30Z [default wallet] Keys: 2005 plaintext, 0 encrypted, 2005 w/ metadata, 2005 total. Unknown wallet records: 1
2019-05-06T14:43:30Z Syncing txindex with block chain from height 694205
2019-05-06T14:43:30Z [default wallet] Wallet completed loading in             123ms
2019-05-06T14:43:30Z [default wallet] setKeyPool.size() = 2000
2019-05-06T14:43:30Z [default wallet] mapWallet.size() = 7
2019-05-06T14:43:30Z [default wallet] mapAddressBook.size() = 4
2019-05-06T14:43:30Z mapBlockIndex.size() = 1515581
2019-05-06T14:43:30Z nBestHeight = 927391
2019-05-06T14:43:30Z torcontrol thread start
2019-05-06T14:43:30Z Bound to [::]:18333
2019-05-06T14:43:30Z Bound to 0.0.0.0:18333
2019-05-06T14:43:30Z init message: Loading P2P addresses...
2019-05-06T14:43:30Z Loaded 10420 addresses from peers.dat  36ms
2019-05-06T14:43:30Z init message: Loading banlist...
2019-05-06T14:43:30Z Loaded 0 banned node ips/subnets from banlist.dat  29ms
2019-05-06T14:43:30Z init message: Starting network threads...
2019-05-06T14:43:30Z net thread start
2019-05-06T14:43:30Z dnsseed thread start
2019-05-06T14:43:30Z addcon thread start
2019-05-06T14:43:30Z msghand thread start
2019-05-06T14:43:30Z init message: Done loading
2019-05-06T14:43:30Z opencon thread start
</code></pre>

CC BY-SA 4.0
2019-05-06T14:31:05.017Z
Can you provide the contents of the debug.log file?
Ava Chow
CC BY-SA 4.0
2019-05-06T14:40:54.443Z
Sorry @AndrewChow I forgot to put that. I'll edit the question with the content that appears after I run bitcoind, because after that all that appears in there are "UpdateTip", "Requesting block", "received block" and "getdata" messages.
Victor Pietro Moreno
CC BY-SA 4.0
2019-05-06T16:35:56.173Z
It looks like bitcoind is unable to bind to port 18332. Given that running as sudo works, it sounds like there is a permissions problem with your system which is preventing non-root users to bind to port 18332.
Ava Chow
CC BY-SA 4.0
2019-05-06T17:28:03.443Z
Thanks, it indeed makes sense. Is there any way I could possibly verify why or how my 18332 port is being prevented from being binded?
Victor Pietro Moreno
<bitcoind><json-rpc><testnet><connection><port>
Connection Refused when running bitcoind in a non-root user and trying to make RPC calls
Victor Pietro Moreno
# Connection Refused when running bitcoind in a non-root user and trying to make RPC calls

(Asked by: username_0 on 2019-05-06)

I'm new to Bitcoin development and I'm currently having difficulties trying to make RPC calls to a Bitcoin-Core daemon running in a SSH server. I suppose that the problem is with Firewall or closed ports, but I also do not know much about Network settings.
I'm using nbobtc/bitcoind-php package to make the RPC calls with HTTP requests, and it is running in a Docker container. I'm sure this is working and is not the problem.
So here's what happening: when I run bitcoind in a normal user in my SSH server, and using nbobtc package to make the RPC calls, the connection always get refused in port 18332 (that is conffirmed when I try to telnet that port in SSH's ip address):

Failed to connect to 192.168.xx.xxx port 18332: Connection refused

However, when I run bitcoind in super user (root), the RPC calls works just perfectly. But as I did not want to run bitcoind in root user, I'd like to find out what may be blocking me from making RPC calls to a normal user - or if is it even possible.
I've tried to open ports with 'sudo ufw allow 18332' and also with IPTABLES (but actually I'm not sure which one is being used by the SSH - it wasn't me who configured it). I'm not sure if they have worked as with nc and telnet commands connection is still being refused.
Here's what my bitcoin.conf looks like (I want to use testnet in here):
server=1
debug=net
txindex=1
testnet=1
rpcuser=userb
rpcpassword=test
test.rpcport=18332

# I've already tried allowing the IP these 3 ways:
# rpcallowip=192.168.xx.xx  # My machine's IP
# rpcallowip=172.19.x.x/xx  # Docker's NBOBTC container IP
# rpcallowip=0.0.0.0/0      # Allowing all IP

datadir=/home/bitcoin-dev/.bitcoin
debuglogfile=/home/bitcoin-dev/.bitcoin/debug.log

PS: I'm using Bitcoin-Core "subversion": "Satoshi:0.17.1"
Here's what appears in debug.log right after I run Bitcoind:
2019-05-06T14:43:10Z Bitcoin Core version v0.17.1 (release build)
2019-05-06T14:43:10Z InitParameterInteraction: parameter interaction: -whitelistforcerelay=1 -> setting -whitelistrelay=1
2019-05-06T14:43:10Z Assuming ancestors of block 0000000000000037a8cd3e06cd5edbfe9dd1dbcc5dacab279376ef7cfc2b4c75 have valid signatures.
2019-05-06T14:43:10Z Setting nMinimumChainWork=00000000000000000000000000000000000000000000007dbe94253893cbd463
2019-05-06T14:43:10Z Using the 'sse4(1way),sse41(4way)' SHA256 implementation
2019-05-06T14:43:10Z Default data directory /root/.bitcoin
2019-05-06T14:43:10Z Using data directory /home/bitcoin-dev/.bitcoin/testnet3
2019-05-06T14:43:10Z Using config file /home/bitcoin-dev/.bitcoin/bitcoin.conf
2019-05-06T14:43:10Z Using at most 125 automatic connections (1024 file descriptors available)
2019-05-06T14:43:10Z Using 16 MiB out of 32/2 requested for signature cache, able to store 524288 elements
2019-05-06T14:43:10Z Using 16 MiB out of 32/2 requested for script execution cache, able to store 524288 elements
2019-05-06T14:43:10Z Using 4 threads for script verification
2019-05-06T14:43:10Z scheduler thread start
2019-05-06T14:43:10Z Binding RPC on address 0.0.0.0 port 18332 failed.
2019-05-06T14:43:10Z HTTP: creating work queue of depth 16
2019-05-06T14:43:10Z Config options rpcuser and rpcpassword will soon be deprecated. Locally-run instances may remove rpcuser to use cookie-based auth, or may be replaced with rpcauth. Please see share/rpcauth for rpcauth auth generation.
2019-05-06T14:43:10Z HTTP: starting 4 worker threads
2019-05-06T14:43:10Z Using wallet directory /home/bitcoin-dev/.bitcoin/testnet3/wallets
2019-05-06T14:43:10Z init message: Verifying wallet(s)...
2019-05-06T14:43:10Z Using BerkeleyDB version Berkeley DB 4.8.30: (April  9, 2010)
2019-05-06T14:43:10Z Using wallet wallet.dat
2019-05-06T14:43:10Z BerkeleyEnvironment::Open: LogDir=/home/bitcoin-dev/.bitcoin/testnet3/wallets/database ErrorFile=/home/bitcoin-dev/.bitcoin/testnet3/wallets/db.log
2019-05-06T14:43:10Z net: setting try another outbound peer=false
2019-05-06T14:43:10Z Cache configuration:
2019-05-06T14:43:10Z * Using 2.0MiB for block index database
2019-05-06T14:43:10Z * Using 56.0MiB for transaction index database
2019-05-06T14:43:10Z * Using 8.0MiB for chain state database
2019-05-06T14:43:10Z * Using 384.0MiB for in-memory UTXO set (plus up to 286.1MiB of unused mempool space)
2019-05-06T14:43:10Z init message: Loading block index...
2019-05-06T14:43:10Z Opening LevelDB in /home/bitcoin-dev/.bitcoin/testnet3/blocks/index
2019-05-06T14:43:10Z Opened LevelDB successfully
2019-05-06T14:43:10Z Using obfuscation key for /home/bitcoin-dev/.bitcoin/testnet3/blocks/index: 0000000000000000
2019-05-06T14:43:19Z LoadBlockIndexDB: last block file = 161
2019-05-06T14:43:19Z LoadBlockIndexDB: last block file info: CBlockFileInfo(blocks=755, size=30875345, heights=1513309...1514061, time=2019-04-29...2019-05-03)
2019-05-06T14:43:19Z Checking all blk files are present...
2019-05-06T14:43:20Z Opening LevelDB in /home/bitcoin-dev/.bitcoin/testnet3/chainstate
2019-05-06T14:43:20Z Opened LevelDB successfully
2019-05-06T14:43:20Z Using obfuscation key for /home/bitcoin-dev/.bitcoin/testnet3/chainstate: 2686d59caeb1917c
2019-05-06T14:43:20Z Loaded best chain: hashBestChain=00000000b3b6a5db140b6058b7abe5cb00d8af61afd2a237ae3468cd36e387fa height=927391 date=2016-09-08T15:04:00Z progress=0.311180
2019-05-06T14:43:20Z init message: Rewinding blocks...
2019-05-06T14:43:29Z init message: Verifying blocks...
2019-05-06T14:43:29Z Verifying last 6 blocks at level 3
2019-05-06T14:43:29Z [0%]...[16%]...[33%]...[50%]...[66%]...[83%]...[99%]...[DONE].
2019-05-06T14:43:29Z No coin database inconsistencies in last 6 blocks (500 transactions)
2019-05-06T14:43:29Z  block index           19450ms
2019-05-06T14:43:29Z Opening LevelDB in /home/bitcoin-dev/.bitcoin/testnet3/indexes/txindex
2019-05-06T14:43:30Z Opened LevelDB successfully
2019-05-06T14:43:30Z Using obfuscation key for /home/bitcoin-dev/.bitcoin/testnet3/indexes/txindex: 0000000000000000
2019-05-06T14:43:30Z init message: Loading wallet...
2019-05-06T14:43:30Z txindex thread start
2019-05-06T14:43:30Z [default wallet] nFileVersion = 170100
2019-05-06T14:43:30Z [default wallet] Keys: 2005 plaintext, 0 encrypted, 2005 w/ metadata, 2005 total. Unknown wallet records: 1
2019-05-06T14:43:30Z Syncing txindex with block chain from height 694205
2019-05-06T14:43:30Z [default wallet] Wallet completed loading in             123ms
2019-05-06T14:43:30Z [default wallet] setKeyPool.size() = 2000
2019-05-06T14:43:30Z [default wallet] mapWallet.size() = 7
2019-05-06T14:43:30Z [default wallet] mapAddressBook.size() = 4
2019-05-06T14:43:30Z mapBlockIndex.size() = 1515581
2019-05-06T14:43:30Z nBestHeight = 927391
2019-05-06T14:43:30Z torcontrol thread start
2019-05-06T14:43:30Z Bound to [::]:18333
2019-05-06T14:43:30Z Bound to 0.0.0.0:18333
2019-05-06T14:43:30Z init message: Loading P2P addresses...
2019-05-06T14:43:30Z Loaded 10420 addresses from peers.dat  36ms
2019-05-06T14:43:30Z init message: Loading banlist...
2019-05-06T14:43:30Z Loaded 0 banned node ips/subnets from banlist.dat  29ms
2019-05-06T14:43:30Z init message: Starting network threads...
2019-05-06T14:43:30Z net thread start
2019-05-06T14:43:30Z dnsseed thread start
2019-05-06T14:43:30Z addcon thread start
2019-05-06T14:43:30Z msghand thread start
2019-05-06T14:43:30Z init message: Done loading
2019-05-06T14:43:30Z opencon thread start

**Tags:** bitcoind, json-rpc, testnet, connection, port

> **Comments:**
> **username_1**: Can you provide the contents of the debug.log file?  
> **username_0**: Sorry @AndrewChow I forgot to put that. I'll edit the question with the content that appears after I run bitcoind, because after that all that appears in there are "UpdateTip", "Requesting block", "received block" and "getdata" messages.  
> **username_1**: It looks like bitcoind is unable to bind to port 18332. Given that running as sudo works, it sounds like there is a permissions problem with your system which is preventing non-root users to bind to port 18332.  
> **username_0**: Thanks, it indeed makes sense. Is there any way I could possibly verify why or how my 18332 port is being prevented from being binded?  

---

## 0 answers

