Why is permission denied during pssh?
I am trying to add an ssh public key to a bunch of servers authorized_keys file. My thought was to use pssh and a list of hosts. To test, I tried to pssh to one host:
pssh -i -H root@host echo mypublickeyasastring >> /root/.ssh/authorized_keys
When I run this, I get:
-bash: /root/.ssh/authorized_keys: Permission denied
If, from the same server I run pssh, I just ssh into the host ssh root@host
, I get in okay and I can run echo mypublickeyasastring >> /root/.ssh/authorized_keys
just fine.
I've been skimming the pssh man page but I can't seem to find anything. Am I missing something? Is there a better way to do this?
The output redirection is happening on the local machine. You need to quote the command to protect the >>.