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