<p>I do not see the "necessary" relevance to bitcoin here. File access security is better discussed in unix relevant stackexchange. Still I'd like to share my view with the little bit of bitcoind relevance.</p>

<blockquote>
  <p>One argument against using ~/home/.bitcoin/bitcoin.conf I thought of
  is the RPC Password is be stored in the .conf file and could be viewed
  by anyone with read access.</p>
</blockquote>

<p>depends how you setup your bitcoin system. If bitcoind is setup as a <strong>user related process</strong>, it makes absolutely sense to have bitcoind.conf in home directory. You may then secure the file with "chmod 600", so only the owner can read/write the bitcoind.conf file (and root and/or the admins after tweaking the permissions).</p>

<p>When storing in /etc, the "chmod 660" makes more sense, then owner and group can read/write the file. In this case I'd be having bitcoind running as a systemwide daemon. But to be honest, I haven't seen such a setup discussed anywhere. This would be ok for a <strong>static setup</strong> (using shell scripts to startup), but imagine you use it every day for tx generation or status checks. Every call to the bitcoind executable would require the correct path to the config file, and if not, bitcoind creates one (in your home dir), and then it might give RPC access problems... </p>

<blockquote>
  <p>Item #2 Similar to #1, besides +1 style points, is there any advantage
  to moving logs to /var/log?</p>
</blockquote>

<p>This again depends on the distribution used. My OpenBSD uses syslog (to /var/log), whereas the OpenSuSE systems have introduced last recently the journal system, where all logging is in a database. I must admit, I am more comfortable with /var/log, but when my beloved OpenBSD would also go away from /var/log, then what to do with bitcoin system logs?
So generally I'd say, /var/log should remain for the unix system related logging, and each application (I consider bitcoind as an application) should have it's own log (and related directory). This makes separation of duties on a larger unixoide system more easy, and the sysadmins wouldn't find irrelevant data in their well known /var/log directory. </p>

CC BY-SA 4.0
2018-11-10T15:11:21.390Z
2018-11-10T15:11:21.390Z
pebwindkraft
<p>I'm setting up and hardening a dedicated headless bitcoind and lightning daemon and wanted to have a discussion about location of the bitcoin.conf.</p>

<p>Item #1:</p>

<p>Bitcoind defaults to using <code>~/.bitcoin/bitcoin.conf</code>, presumably because keeping all relevant files in one location makes it easier to copy and/or share the blockchain between different machines. Are there security implications to this? Is it substantively safer to store bitcoin.conf in <code>/etc</code> instead (such as <code>/etc/bitcoind/bitcoin.conf</code>)? </p>

<p>One argument against using <code>~/home/.bitcoin/bitcoin.conf</code> I thought of is the RPC Password is be stored in the .conf file and could be viewed by anyone with read access. So it is less readable in ~/home or in /etc?</p>

<p>I'd get +1 POSIX-style-points for using /etc...</p>

<p>One argument against using <code>/etc/bitcoind/bitcoin.conf</code> is portability. It is less convenient to have the .conf file in a separate location. Less convenient means greater chance of mistake or error sometime down the road.</p>

<p>Item #2
Similar to #1, besides +1 style points, is there any advantage to moving logs to <code>/var/log</code>? My understanding is bitcoind already rotates logs, but is there an advantage to how systemd does log rotation in <code>/var/log</code>?</p>

<hr>

<p>Thanks, these are good points. You're right about bitcoin.conf being in /etc and it causing difficulty accessing the daemon on a day-to-day basis. In my case this server is meant to serve a small local workgroup on the same machine and on the LAN and has bitcoind running without a wallet to serve a local lnd and electrumx instance. Both of these access bitcoind through RPC via localhost, so the location of bitcoin.conf is irrelevant to them. </p>

<p>Even if bitcoind was run as a system-level service to be used as a wallet, users wouldn't necessarily need to access bitcoin.conf if they used RPC. Local users could each have their own bitcoin.conf in their home folders with RPC credentials. This would eliminate their need to specify bitcoin.conf at the command line.</p>

<blockquote>
  <p>You may then secure the file with "chmod 600", so only the owner can read/write >the bitcoind.conf file (and root and/or the admins after tweaking the >permissions).</p>
</blockquote>

<p>^^This would do more for security than just moving to /etc.</p>

<p>So there is no one right answer, but that if running bitcoind as a system-level service it might make more sense (if not actually increase security) and get +1 POSIX style points to put bitcoin.conf in /etc, but if running bitcoind in the user space for a single local user it makes more sense just to keep everything in ~/home to save RPC credentialing hassles. </p>

CC BY-SA 4.0
2018-11-09T10:50:47.293Z
You *"wanted to have a discussion"* -- remember this is not a discussion forum. According the the [help/dont-ask] we should avoid open-ended chatty questions for the reasons given there. Your Item #2 is mostly off-topic here and would best be answered by reading existing answers in (for example) our sister-site https://serverfault.com
RedGrittyBrick
CC BY-SA 4.0
2018-11-09T16:41:36.470Z
OK, so I changed my mind. I don't want to 'have a discussion' I simply want an answer to the following question: 

Is it "best" to keep bitcoin.conf in /etc/ or in ~/home/.bitcoin?
Mike
<bitcoin-core><bitcoind><daemon>
Security implications of bitcoin.conf location
Mike
# Security implications of bitcoin.conf location

(Asked by: username_0 on 2018-11-09)

I'm setting up and hardening a dedicated headless bitcoind and lightning daemon and wanted to have a discussion about location of the bitcoin.conf.

Item #1:

Bitcoind defaults to using `~/.bitcoin/bitcoin.conf`, presumably because keeping all relevant files in one location makes it easier to copy and/or share the blockchain between different machines. Are there security implications to this? Is it substantively safer to store bitcoin.conf in `/etc` instead (such as `/etc/bitcoind/bitcoin.conf`)?

One argument against using `~/home/.bitcoin/bitcoin.conf` I thought of is the RPC Password is be stored in the .conf file and could be viewed by anyone with read access. So it is less readable in ~/home or in /etc?

I'd get +1 POSIX-style-points for using /etc...

One argument against using `/etc/bitcoind/bitcoin.conf` is portability. It is less convenient to have the .conf file in a separate location. Less convenient means greater chance of mistake or error sometime down the road.

Item #2
Similar to #1, besides +1 style points, is there any advantage to moving logs to `/var/log`? My understanding is bitcoind already rotates logs, but is there an advantage to how systemd does log rotation in `/var/log`?

---

Thanks, these are good points. You're right about bitcoin.conf being in /etc and it causing difficulty accessing the daemon on a day-to-day basis. In my case this server is meant to serve a small local workgroup on the same machine and on the LAN and has bitcoind running without a wallet to serve a local lnd and electrumx instance. Both of these access bitcoind through RPC via localhost, so the location of bitcoin.conf is irrelevant to them.

Even if bitcoind was run as a system-level service to be used as a wallet, users wouldn't necessarily need to access bitcoin.conf if they used RPC. Local users could each have their own bitcoin.conf in their home folders with RPC credentials. This would eliminate their need to specify bitcoin.conf at the command line.

> You may then secure the file with "chmod 600", so only the owner can read/write >the bitcoind.conf file (and root and/or the admins after tweaking the >permissions).

^^This would do more for security than just moving to /etc.

So there is no one right answer, but that if running bitcoind as a system-level service it might make more sense (if not actually increase security) and get +1 POSIX style points to put bitcoin.conf in /etc, but if running bitcoind in the user space for a single local user it makes more sense just to keep everything in ~/home to save RPC credentialing hassles.

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

> **Comments:**
> **username_1**: You *"wanted to have a discussion"* -- remember this is not a discussion forum. According the the [help/dont-ask] we should avoid open-ended chatty questions for the reasons given there. Your Item #2 is mostly off-topic here and would best be answered by reading existing answers in (for example) our sister-site https://serverfault.com  
> **username_0**: OK, so I changed my mind. I don't want to 'have a discussion' I simply want an answer to the following question:   Is it "best" to keep bitcoin.conf in /etc/ or in ~/home/.bitcoin?  

---

## 1 answers

### Answer by username_2 on 2018-11-10. Score: 1

I do not see the "necessary" relevance to bitcoin here. File access security is better discussed in unix relevant stackexchange. Still I'd like to share my view with the little bit of bitcoind relevance.

> One argument against using ~/home/.bitcoin/bitcoin.conf I thought of
> is the RPC Password is be stored in the .conf file and could be viewed
> by anyone with read access.

depends how you setup your bitcoin system. If bitcoind is setup as a **user related process**, it makes absolutely sense to have bitcoind.conf in home directory. You may then secure the file with "chmod 600", so only the owner can read/write the bitcoind.conf file (and root and/or the admins after tweaking the permissions).

When storing in /etc, the "chmod 660" makes more sense, then owner and group can read/write the file. In this case I'd be having bitcoind running as a systemwide daemon. But to be honest, I haven't seen such a setup discussed anywhere. This would be ok for a **static setup** (using shell scripts to startup), but imagine you use it every day for tx generation or status checks. Every call to the bitcoind executable would require the correct path to the config file, and if not, bitcoind creates one (in your home dir), and then it might give RPC access problems...

> Item #2 Similar to #1, besides +1 style points, is there any advantage
> to moving logs to /var/log?

This again depends on the distribution used. My OpenBSD uses syslog (to /var/log), whereas the OpenSuSE systems have introduced last recently the journal system, where all logging is in a database. I must admit, I am more comfortable with /var/log, but when my beloved OpenBSD would also go away from /var/log, then what to do with bitcoin system logs?
So generally I'd say, /var/log should remain for the unix system related logging, and each application (I consider bitcoind as an application) should have it's own log (and related directory). This makes separation of duties on a larger unixoide system more easy, and the sysadmins wouldn't find irrelevant data in their well known /var/log directory.


---

