Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


  Search this Thread
Old 02-16-2012, 06:55 AM   #1
LQ Newbie
Registered: Oct 2011
Location: Florence, IT
Distribution: Debian testing
Posts: 9

Rep: Reputation: Disabled
Connect to a proxy through a middle host with a ssh tunnel

Hi everyone,
I've tried to exploit this thing the whole morning, but I couldn't find a way out.
Let me explain my situation: my university gives to student a proxy access to the university network to let them look for science articles and so on on the net and download them without paying because the university already has contracts with them.
The problem is that the dorm I'm in has a firewall which doesn't let me connect to the proxy and the sysadmins already said that they won't open that port.

Fortunatly enough, I have ssh access on a server where I keep my personal website and so on, so I was thinking to use this opportunity (since I can do ssh from my dorm) to access the proxy. What I have in mind is this:

"my laptop" == ssh tunnel ==> "hosting server" == connect ==> "proxy server"

In this way I should be able to reach the proxy from within my dorm. Surfing the net I've found the program connect and this piece of information:
So, first of all I've tried to ssh into my hosting server and launched the connect command from there with

connect -p 3128 3128
and then create a ssh tunnel (from my shell) with

ssh -f user@hosting-server -L 3128:localhost:3128 -N
And it kind of works: setting firefox to use localhost:3128 as a proxy I can open one internet page, but after that the connect instance on the hosting server dies and I can't connect anymore. Basically, I shoud run again the program for each page I open.

Trying to keep things simple, I've also tried the command suggested on the link above, and from my shell I run:

ssh user@hosting-server connect 3128
but after asking for the ssh password I receive this message:

bash: connect: command not found
Of course connect is installed in the server and in the path.

So, do you have any suggestion on how I can make this thing work? It doesn't need to be a ssh tunnel or whatever, I just want access to the proxy.
Old 02-16-2012, 07:11 AM   #2
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975
I don't follow the logic of using the connect command. in your ssh command you're connecting to that socket that connect created, right? Well don't do that, just tell ssh to connect directly to the proxy, it's simpler than you think.
ssh user@hosting-server -L
that will give you a simple "dog legged" connection.

Last edited by acid_kewpie; 02-16-2012 at 07:12 AM.
Old 02-16-2012, 09:17 AM   #3
Registered: Dec 2010
Posts: 64

Rep: Reputation: 6
Just for the sake of being 100% sure everything will be understood:

1) The tunnel acid_kewpie mentions must remain open. If for any reason you close the connection, you just have to open it again.
2) You have to tell your web clients to use http://localhost:3128 as proxy

Last edited by omgs; 02-16-2012 at 09:18 AM.
Old 02-16-2012, 12:02 PM   #4
LQ Newbie
Registered: Oct 2011
Location: Florence, IT
Distribution: Debian testing
Posts: 9

Original Poster
Rep: Reputation: Disabled
It works like a charm, thank you very much. I'm still trying to grasp the full basics of ssh tunneling.

Last edited by iacchi; 02-16-2012 at 12:04 PM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
SSH tunnel proxy in Akonadi/Kontact/KMail desade Linux - Networking 5 01-18-2017 08:55 AM
Need help for SSH tunnel through NTLM-authenticated HTTP proxy theYinYeti Linux - Networking 3 02-25-2012 02:15 PM
Initiate ssh tunnel to connect to ssh? brianmcgee Linux - Security 2 09-07-2011 10:07 AM
ftp proxy via ssh tunnel on server side using what? drobert Linux - Software 3 05-09-2011 04:38 PM
How do I set up an ssh tunnel through a http proxy? wilko Linux - Networking 2 03-10-2010 01:05 PM > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 01:52 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration