What is the Putty equivalent command for Mac OS X?

1

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?

Martin

Posted 2012-02-04T07:25:41.020

Reputation:

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 – 2012-02-04T14:09:26.300

Answers

6

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

James Polley

Posted 2012-02-04T07:25:41.020

Reputation: 5 892

Thx James. I will try your answer out. :)) . As to why I would ports to localhost, it is needed for bypassing stubborn firewalls. – None – 2012-02-04T07:57:14.270

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 – None – 2012-02-04T08:04:12.517

Hah. I missed that. it'll be -p 8888 rather than -P 8888 :) – James Polley – 2012-02-04T08:57:50.377

5

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

Giovanni Toraldo

Posted 2012-02-04T07:25:41.020

Reputation: 162

2

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

jcisio

Posted 2012-02-04T07:25:41.020

Reputation: 317

Thx for the suggestion. Just tried it but it failed. – None – 2012-02-04T08:44:31.583

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 – 2012-02-04T08:46:13.420

Did'nt work out :(( – None – 2012-02-04T09:43:59.813

0

Not sure if this is still relevant or not. But I used this command.

ssh -L 8080:192.168.0.12:9991 remote_user@192.168.0.12

Basically,

ssh -L local_port:remote_ip:remote_port remote_user@remote_ip

p01ntbl4nk

Posted 2012-02-04T07:25:41.020

Reputation: 1