Warren Young wrote:
Les Mikesell wrote:
[...]
This requires that the public key for localuser on host1 exists in host2:.ssh/authorized_keys. It also requires "PermitRootLogin yes" in /etc/ssh/sshd_config, which is unfortunately the default on CentOS. (I usually turn it off.)
Unfortunately? I could not live w/o it ;-)
Also realize that remotecmd can be a very complex thing, not just a simple command. You can use pipes and other things through ssh.
If using IO redirections or pipes, be sure to quote them correctly:
[localuser@host1 ~]$ ssh root@host2 remotecmd > /tmp/file
will create /tmp/file with the output of remotecmd on host1 (!), while
[localuser@host1 ~]$ ssh root@host2 remotecmd ">" /tmp/file
will create /tmp/file on host2.
Cheers
frank