Super User is a question and answer site for computer enthusiasts and power users. 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

Maybe the title must be changed but I have the following situation:

  • I can ssh to a host A

  • From A, I can ssh into a machine B, but this machine cannot be accessed from my computer. The name of the machine (as well as its ip) is local only.

  • How can I sshfs (and/or use scp) directly to machine B, without having to scp files from B->A and then from A->my machine. I'm really loosing productivity that way,

PS: I can't change configs in A nor B...

share|improve this question
up vote 4 down vote accepted

If you authenticate to B with credentials accessible on your computer (let’s call it W), for example a password/username tuple (rather than keys on A), you can build a SSH tunnel, for example:

W $ ssh -L 1234:B:22 A

and then

W $ ssh -p 1234 usernameB@

or similarly with scp and sshfs. I. e. port 1234 on your local machine (usually or ::1) is forwarded to B, port 22 from the perspective of A.

share|improve this answer
Works Perfectly! – SshProblem Oct 8 '12 at 14:10
If you want to bind to a specific address locally, for example to allow another computer, W2, on the same network as W, to connect to B’s port 22, simply use W $ ssh -L A, where is the external IP address of W. – Claudius Oct 8 '12 at 14:12

If you have netcat on the host A, then ssh's ProxyCommand is your friend.

Edit your local .ssh/config as follows

Host B
    HostName B.internal.domain
    ProxyCommand ssh A nc %h %p 2> /dev/null

Then when you try to ssh into host B: It first creates a ssh session to A then tunnels the traffic through netcat (nc) to host B's (%h) port 22 (%p).

share|improve this answer

What OS are you and your destination running?

If it's Linux, then the Zmodem protocol is perfect for what you are trying to do.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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