1

Possible Duplicate:
How do I connect to a pc through another pc using ssh

How to go about doing in one command line the following operations?

$ ssh server-one
$ su - user
$ ssh server-two

Of course I cannot directly ssh user@server-two

2 Answers2

6
ssh server-one -t ssh user@localhost -t ssh server-two

From man ssh:

     -t      Force pseudo-tty allocation.  This can be 
             used to execute arbitrary screen-based programs 
             on a remote machine, which can be very useful, 
             e.g. when implementing menu services.  Multiple -t
             options force tty allocation, even if ssh has no local tty.
rush
  • 27,403
2
ssh -t server-one 'su - user -c "ssh server-two"'