[CentOS] scp with tty

Tue Oct 13 19:53:54 UTC 2009
Warren Young <warren at etr-usa.com>

Les Mikesell wrote:
> 
> I'm still missing why you'd need to sudo inside the remote shell instead 
> of ssh'ing as the right user in the first place.  

Perhaps he doesn't know the user@ syntax.

Tony, try this:

	[localuser at host1 ~]$ ssh root at host2 remotecmd

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.)

Beware that this makes localuser on host1 equivalent to root on host2!

Also realize that remotecmd can be a very complex thing, not just a 
simple command.  You can use pipes and other things through ssh.