How can I make ports forwarded or proxied by ssh available to machines other than the local machine?

e.g. machine A connecting to machine B (works)

ssh -L8080:some-service:8080 user@machine-B

machine C connecting to Machine B through Machine A's forwarded port (doesn't work)

curl machine-A:8080

I get

curl: (7) Failed to connect to machine-A port 8080: Connection refused

machine A connecting to Machine B through machine A's forwarded port (does work)

  • How did you get an error about port 80 when you're trying to connect to port 8080? You dun goofed somewhere. – user143703 Dec 15 '14 at 20:55
  • @wmarbut: then your curl command should also be curl, right? – Ale Dec 15 '14 at 20:58
  • @Ale. yeah. sorry. – wmarbut Dec 15 '14 at 21:05

You can use the -g option:

 -g      Allows remote hosts to connect to local forwarded ports.


ssh -L8080:some-service:8080 -g user@machine-B

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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