6

I want to set up port forwarding with ssh like so:

ssh user@10.10.10.10 -L 5656:remoteserver:80 -N

and then run a curl command:

curl http://localhost:5656/my/endpoint/

I can accomplish this just fine using two commands, but how can I combine them into a single working command?

I'm on OSX if that matters.

tmatti
  • 63

1 Answers1

7

Do you really need to do both of the things? Would not be easier to curl on the remote server and pull the result without port forwarding, such as

ssh user@10.10.10.10 curl http://remoteserver/my/endpoint/ -o - > result
Jakuje
  • 21,357