Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question

migrated from serverfault.com Feb 4 '12 at 10:01

This question came from our site for professional system and network administrators.

    
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 '12 at 14:09

3 Answers 3

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 ;)

share|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 '12 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 '12 at 8:04
    
Hah. I missed that. it'll be -p 8888 rather than -P 8888 :) –  James Polley Feb 4 '12 at 8:57

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
share|improve this answer

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
share|improve this answer
    
Thx for the suggestion. Just tried it but it failed. –  Martin Feb 4 '12 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 '12 at 8:46
    
Did'nt work out :(( –  Martin Feb 4 '12 at 9:43

Your Answer

 
discard

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