Re: ssh and su
- From: GaGadget <GaGadgetNOSP@xxxxxxxx>
- Date: Sat, 25 Mar 2006 09:37:09 +0100
Darren Tucker wrote:
On 2006-03-24, GaGadget <GaGadgetNOSP@xxxxxxxx> wrote:
I would like to be able to launch command as root on distant machines
using ssh. As those machines do not allow root login directly, the idea
is to use "su", but here is what I got :
$ ssh foo.bar "su root -c \"ls -l\""
user1@xxxxxxx's password: <= I entered the distant machine's root
password su: Sorry
Assuming the bit where you said you entered the root password where it
prompted for for user1's is a mistake, it's probably failing because su
will try to read the root password from a tty and the remote command
doesn't have one. Adding "-t" to the ssh command line ought to help.
You are right I meant :
user1@xxxxxxx's password: <= I entered the machine's _user1_ password
I tried the "-t" on my linux box at home and it seems to do the trick, I
will try on Monday at Office's machines and let you know.
I read the man pages several times, seems I missed it. RTFM !