How do I backup my wallet with bitcoin-cli over RPC? 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
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.