In my Windows system, I was able to create a tunnel by running the command below using Putty:

putty.exe -D 12345 -P 8888 localhost

I'm not used to Mac yet and I would like to try it out on Mac. Does anyone know the command to achieve same tunneling in Mac OS X or do I have to use a client?

link|improve this question
What are you trying to accomplish? I don't know putty command line options, so I'm not sure what traffic you're actually trying to forward, and in which direction. – cjc Feb 4 at 14:09
feedback

migrated from serverfault.com Feb 4 at 10:01

This question came from our site for system administrators and desktop support professionals.

3 Answers

putty's command-line options are (mostly, but not entirely) a clone of those that the openssh client uses, so the equivalent of your command line above would just be ssh -D 12345 -p 8888 localhost.

Read man ssh for the full details of the options.

Well. I don't know why you'd forward ports to localhost, but I'm sure that was just a demo ;)

link|improve this answer
Thx James. I will try your answer out. :)) . As to why I would ports to localhost, it is needed for bypassing stubborn firewalls. – Martin Feb 4 at 7:57
UPDATE: I just tried it but it failed, it appears an attempt was made to connect Host 8888 on port 22 which is wrong. ........................ ssh -D 12345 -P 8888 localhost ssh: connect to host 8888 port 22: Network is unreachable – Martin Feb 4 at 8:04
Hah. I missed that. it'll be -p 8888 rather than -P 8888 :) – James Polley Feb 4 at 8:57
feedback

MacOSX provide by default a command-line ssh client, just execute it from a terminal with:

$ ssh user@hostname

To check that options are the same that you are accustomed with PuTTY, read the ssh man reference with:

$ man ssh
link|improve this answer
feedback

Mac's ssh syntax (and for most other *nix commands) is not the same as in a Linux box. I think you could try ssh -D 12345 -p 8888 localhost, but I don't remember quite well. The best way is man ssh.

I usually make a config file (.ssh/config) with parameters so that you can simply type ssh bypassfw if you want to run that command.

Host bypassfw
HostName localhost
Port 8888
DynamicForward 12345
link|improve this answer
Thx for the suggestion. Just tried it but it failed. – Martin Feb 4 at 8:44
I forgot "localhost" in the command. I also added a .ssh/config file, the method which I used when I was on Mac. However, did you try man ssh? – jcisio Feb 4 at 8:46
Did'nt work out :(( – Martin Feb 4 at 9:43
feedback

Your Answer

 
or
required, but never shown