Re: ssh and su



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 !

Thank you,
Gaga.
.



Relevant Pages

  • RE: Dead SSH Connections from script
    ... >> dead SSH connections around, ... root on one machine to access all other machines thru SSH as root. ... we have told all the client machines that our server is an ...
    (RedHat)
  • Re: Things Linux Can Do Without
    ... root password, for example h1b32pp2m33, disable logon of root vis SSH ... already knows the username. ...
    (comp.os.linux.misc)
  • Re: ssh allowing root login with no password
    ... of our machines have to have root login access with ssh and the ... we will login as another account and su to root. ... open up the firewall to allow ssh access from anywhere, ...
    (RedHat)
  • Re: Question restricting ssh access for some users only
    ... We would like to allow root ssh login to our machines but only ...
    (FreeBSD-Security)
  • RE: root password problem
    ... is it possible you did something that could have corrupted the passwd file ... Subject: root password problem ... I downloaded Fedora Core 2 4 days ago and installed on two machines. ...
    (Fedora)