Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question

marked as duplicate by Gilles, jw013, manatwork, Renan, warl0ck Oct 16 '12 at 15:02

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
This may be a starting point unix.stackexchange.com/a/43097/14084 – Bernhard Oct 16 '12 at 9:35
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.
share|improve this answer
ssh -t server-one 'su - user -c "ssh server-two"'
share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.