How do I backup my wallet with bitcoin-cli over RPC?

0

hendry@knuckles ~ $ bitcoin-cli backupwallet /home/hendry/backup.dat
error code: -1
error message:
boost::filesystem::status: Permission denied: "/home/hendry/backup.dat"

Reddit couldn't help me https://www.reddit.com/r/BitcoinBeginners/comments/aftb91/am_i_running_bitcoin_core/

This is no permission problem.

hendry@knuckles ~ $ touch backup.dat
hendry@knuckles ~ $ ls backup.dat
backup.dat
hendry@knuckles ~ $ rm backup.dat

I suspect the bitcoind -server which runs in isolation as "nobody" is trying to access my home directory, which is a bit of a concern. My user's .bitcoin directory looks fine:

hendry@knuckles ~ $ find .bitcoin/
.bitcoin/
.bitcoin/mempool.dat
.bitcoin/wallets
.bitcoin/wallets/wallet.dat
.bitcoin/wallets/db.log
.bitcoin/wallets/.walletlock
.bitcoin/.lock
.bitcoin/chainstate
.bitcoin/chainstate/000003.log
.bitcoin/chainstate/CURRENT
.bitcoin/chainstate/MANIFEST-000002
.bitcoin/chainstate/LOCK
.bitcoin/fee_estimates.dat
.bitcoin/banlist.dat
.bitcoin/blocks
.bitcoin/blocks/index
.bitcoin/blocks/index/000003.log
.bitcoin/blocks/index/CURRENT
.bitcoin/blocks/index/000004.log
.bitcoin/blocks/index/MANIFEST-000002
.bitcoin/blocks/index/LOCK
.bitcoin/blocks/index/000005.ldb
.bitcoin/blocks/rev00000.dat
.bitcoin/blocks/blk00000.dat
.bitcoin/peers.dat
.bitcoin/bitcoin.conf
.bitcoin/debug.log

hendry

Posted 2019-01-18T01:53:36.113

Reputation: 101

Answers

1

The process writing the file is bitcoind, not bitcoin-cli, which is simply issuing RPC commands to the server.bitcoind needs to be able to write to the destination, which can’t be another users home folders unless you explicitly give it permission.

Anonymous

Posted 2019-01-18T01:53:36.113

Reputation: 10 054

I don't understand this model. I have my private ~/.bitcoin directory with my private stuff there I hope. I interact with the blockchain with bitcoind. It makes no sense for the bitcoind to be able to write to my home folder from my perspective.hendry 2019-01-19T02:47:05.247

The file list you posted is not of a synchronised node, by the way.Anonymous 2019-01-19T02:49:42.927

synchronized afaict https://s.natalian.org/2019-01-19/1547890087_2548x1398.png

hendry 2019-01-19T09:28:39.073