PDA

View Full Version : SSH Terminal help needed urgently.




ketulshah
Feb 27, 2012, 07:05 AM
Hello guys, I doubt this is classified as a programming discussion or no, but this was the nearest it could get to.

I want to SSH tunnel into a server through the LAN connection provided by my university. I am successfully being able to do it using PuTTY on Windows but I failed to bypass the proxy server out here using terminal. Mainly, I don't understand the codes needed to be written in the Terminal. PuTTY was very simple to handle and had an ice GUI.
I'd really appreciate if someone could tell me the command line to use. I read hundreds of pages and saw many videos couldn't get a word out of it.

PS : The computers connect to the internet here after entering the http and https proxies as 172.30.1.1:8080, and I basically want to bypass these and set up an SSH tunnel so that I could apply a SOCKS 5 proxy.



throAU
Feb 27, 2012, 07:18 AM
man ssh


you're looking to use the -R option

-R [bind_address:]port:host:hostport
Specifies that the given port on the remote (server) host is to be forwarded
to the given host and port on the local side. This works by allocating a
socket to listen to port on the remote side, and whenever a connection is made
to this port, the connection is forwarded over the secure channel, and a con-
nection is made to host port hostport from the local machine.


etc

KnightWRX
Feb 27, 2012, 07:19 AM
You're right, this is not a programming question at all. The sub forum you want is Mac Basic Help :

http://forums.macrumors.com/forumdisplay.php?f=78

Since you haven't provided any information on how you want to make your SOCKS proxy, just know that the command line options you want are -L, -R or -D depending on the type of tunnel you want to make. These should be exactly like PuTTY's in their syntax.

So let's say under PuTTY you have an entry labeled :

L3128 localhost:3128

The syntax would be :

-L 3128:localhost:3128

Alternatively, you could just install PuTTY through Macports :

http://www.dotresults.com/2009/10/28/how-to-install-putty-on-os-x/

ketulshah
Feb 28, 2012, 09:41 AM
I really appreciate the support but I'm still not very clear about the command.
See I'll tell you what exactly I entered in the PuTTY for bypassing.

Please tell me what command do I use in the terminal window.

Thanks again.

KnightWRX
Feb 28, 2012, 11:15 AM
So it's like I said :

-D 5555

It's right there in the man page :

-D [bind_address:]port
Specifies a local ``dynamic'' application-level port forwarding. This works by allocating a socket to listen to port on the local side, option-
ally bound to the specified bind_address. Whenever a connection is made to this port, the connection is forwarded over the secure channel, and
the application protocol is then used to determine where to connect to from the remote machine. Currently the SOCKS4 and SOCKS5 protocols are
supported, and ssh will act as a SOCKS server. Only root can forward privileged ports. Dynamic port forwardings can also be specified in the
configuration file.

ketulshah
Feb 29, 2012, 10:27 AM
What I understood from your previous two posts is the command below:


ssh -D 5555 -L 5555:172.30.1.1:8080 user@host.com


Does it mean that it will bypass my proxy of 172.30.1.1 at port 8080 to SOCKS 5 at port 5555, because if it does then it doesn't really work. I get an error, operation timed out.
Please correct me.
Thanks a ton for the posts. BOWS.

KnightWRX
Feb 29, 2012, 02:53 PM
You didn't quite read my posts there. You can't use both -L and -D at the same time on the same local port (5555). And your -L arguments do the opposite of what you want.

Again, read this sentence carefully, it should answer your question :

Since you haven't provided any information on how you want to make your SOCKS proxy, just know that the command line options you want are -L, -R or -D depending on the type of tunnel you want to make. These should be exactly like PuTTY's in their syntax.

So going by your screenshot, you want -D 5555. That's it.

ssh -D 5555 user@host.com

That will do exactly the same thing as your PuTTY does.