1. As already discussed in this thread, you can avoid using
`archive_command` and instead use the streaming_archiver, i.e.,
pg_receivewal. This way, no postgres→barman SSH access is required.
2. In theory, even with archive_command, you could use
~barman/.ssh/authorized_keys to restrict what command may be run via
ssh. See the `command` setting in the authorized_keys(5) manpage. You
would have to write your own archive_command though, so it's not
straightforward, and I wouldn't really recommend it. In fact, now that
I think about it, I don't even know why I brought up the possibility
in the first place.
Just use pg_receivewal, and voilà, no ssh.
-- Abhijit