<p>It is supported according to the <a href="https://github.com/lightningnetwork/lnd/blob/master/docs/INSTALL.md" rel="nofollow noreferrer">LND installation guide</a></p>
<blockquote>
<p>NOTE:</p>
<p>The auth parameters rpcuser and rpcpass parameters can typically be determined by lnd for a bitcoind instance running under the same user, including when using cookie auth. In this case, you can exclude them from the lnd options entirely.</p>
</blockquote>

CC BY-SA 4.0
2019-11-25T20:54:10.330Z
I'm running bitcoind and lnd in two separated docker containers that share a volume where bitcoind save the authentication cookie. The problem is that lnd doesn't allow to specify the folder in which it could find the cookie... In bitcoin.conf for exemple you can specify the path where you can find the authentication cookie of the tor control port...
Zighy Blue
CC BY-SA 4.0
2019-11-23T04:41:45.837Z
2019-11-23T04:41:45.837Z
2020-06-16T11:10:03.350Z
meshcollider
<p>The auth cookie lives in the <code>data_dir</code> for <code>bitcoind</code>.</p>
<p>lnd finds the <code>data_dir</code> by first finding the <code>bitcoin.conf</code> file, which it finds based on the <code>bitcoind.dir</code> argument passed at runtime. It then parses that for the <code>data_dir</code> directive.</p>
<p>You can see this in the src code:
<a href="https://github.com/lightningnetwork/lnd/blob/master/config.go#L1505" rel="nofollow noreferrer">https://github.com/lightningnetwork/lnd/blob/master/config.go#L1505</a></p>
<p>So, if you are using a non-default location for your <code>data_dir</code> you need to ensure that you have a <code>data_dir</code> directive in your <code>bitcoin.conf</code> file and that you pass the <code>bitcoind.dir</code> at runtime.</p>
<p>Note: lnd won't find your <code>data_dir</code> directive if you preface it with <code>main</code> ot <code>test</code>.</p>

CC BY-SA 4.0
2020-11-25T14:17:26.210Z
2020-11-25T14:17:26.210Z
Garreth McDaid
<p>I configured bitcoind RPC to authenticate clients with an authentication cookie. However I cant figure out if it's possible to use this method with lnd while connecting to bitcoind RPC.</p>

<p>I would like to clarify that I'm running bitcoind and lnd in two separated docker containers that share a volume where bitcoind save the authentication cookie. The problem is that lnd doesn't allow to specify the folder in which it could find the cookie... In bitcoin.conf for exemple you can specify the path where you can find the authentication cookie of the tor control port for example...</p>

<p>Someone knows how to do this in lnd ? Is it possible ?</p>

<p>Thank you!</p>

CC BY-SA 4.0
2019-11-23T04:39:47.840Z
It should be possible: https://lightningwiki.net/index.php/RPC_auth_for_bitcoind
meshcollider
CC BY-SA 4.0
2019-11-25T21:01:22.540Z
RPCauth is not the authentication cookie, with authentication cookie you don't need to create a password, a cookie is generated and shared between bitcoind and lnd on the same file system or shared folder...
Zighy Blue
<bitcoind><json-rpc><lightning-network-daemon><authentication>
How to connect LND to bitcoind RPC with authentication cookie stored in a custom folder?
Zighy Blue
# How to connect LND to bitcoind RPC with authentication cookie stored in a custom folder?

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

I configured bitcoind RPC to authenticate clients with an authentication cookie. However I cant figure out if it's possible to use this method with lnd while connecting to bitcoind RPC.

I would like to clarify that I'm running bitcoind and lnd in two separated docker containers that share a volume where bitcoind save the authentication cookie. The problem is that lnd doesn't allow to specify the folder in which it could find the cookie... In bitcoin.conf for exemple you can specify the path where you can find the authentication cookie of the tor control port for example...

Someone knows how to do this in lnd ? Is it possible ?

Thank you!

**Tags:** bitcoind, json-rpc, lightning-network-daemon, authentication

> **Comments:**
> **username_1**: It should be possible: https://lightningwiki.net/index.php/RPC_auth_for_bitcoind  
> **username_0**: RPCauth is not the authentication cookie, with authentication cookie you don't need to create a password, a cookie is generated and shared between bitcoind and lnd on the same file system or shared folder...  

---

## 2 answers

### Answer by username_1 on 2019-11-23. Score: 2

It is supported according to the [LND installation guide](https://github.com/lightningnetwork/lnd/blob/master/docs/INSTALL.md)

> NOTE:
>
> The auth parameters rpcuser and rpcpass parameters can typically be determined by lnd for a bitcoind instance running under the same user, including when using cookie auth. In this case, you can exclude them from the lnd options entirely.

> **Comments:**
> **username_0**: I'm running bitcoind and lnd in two separated docker containers that share a volume where bitcoind save the authentication cookie. The problem is that lnd doesn't allow to specify the folder in which it could find the cookie... In bitcoin.conf for exemple you can specify the path where you can find the authentication cookie of the tor control port...  

---

### Answer by username_2 on 2020-11-25. Score: 0

The auth cookie lives in the `data_dir` for `bitcoind`.

lnd finds the `data_dir` by first finding the `bitcoin.conf` file, which it finds based on the `bitcoind.dir` argument passed at runtime. It then parses that for the `data_dir` directive.

You can see this in the src code:
<https://github.com/lightningnetwork/lnd/blob/master/config.go#L1505>

So, if you are using a non-default location for your `data_dir` you need to ensure that you have a `data_dir` directive in your `bitcoin.conf` file and that you pass the `bitcoind.dir` at runtime.

Note: lnd won't find your `data_dir` directive if you preface it with `main` ot `test`.


---

