Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

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

I'm use my home pc to connect to the corporate server with ssh doing something like:

    ssh -p 2424

Then I log in remotely once more to another server in the corporate network:

    ssh internalcorporatehost

Can I set a ssh tunnel to do this in one step, or are there any other ways to do that?

share|improve this question

Set up as a proxy:

ssh -o 'ProxyCommand ssh -p 2424 nc %h %p' internalcorporatehost

This is best used through an alias in ~/.ssh/config, so you can simply type ssh ich:

Host ich
HostName internalcorporatehost
User user_name_on_internalcorporatehost
ProxyCommand ssh -p 2424 nc %h %p

nc is the netcat command, which must be installed on the gateway machine. If it's not available, install any of the versions floating around (you only need basic functionality). You may need to indicate the full path to the nc binary (e.g. /home/oleg/bin/nc).

If your ssh client is Putty, this answer at Stack Overflow should help.

share|improve this answer

A very easy solution is to just tunnel an SSH command through an other SSH command using the -t flag.

ssh -p 2424 -t  ssh internalcorporatehost

Makes it very easy and you don't need any further config.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .