Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am trying to set up an SSH tunnel with a SOCKS proxy in Firefox, so I can surf the internet securely from public wifi. Both client and server are running Ubuntu 12.04 LTS.

After setting up port forwarding on my router (port 8888 forwards to port 22 on my server at home, at least for this example), I am able to log in via ssh normally using the command:

ssh -p 8888 user@hostname

However, when I follow the "standard" directions for setting up the tunnel, I cannot connect. The directions tell me to use this command:

ssh -D 8888 user@hostname

But all I get is a connection timeout:

ssh: connect to host hostname port 22: Connection timed out

I haven't found any other helpful posts on here (or elsewhere). Any suggestions or ideas? I already added the following line to /etc/ssh/sshd_config on the server and restarted sshd:

AllowTcpForwarding yes

Same result. Suggestions are greatly appreciated.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

You seem to have mixed up what exactly happens here. ssh -p will tell the ssh client on which port the server is listening, and -D will tell it on which port it should listen locally as SOCKS proxy.

You should use it like this:

ssh -p 8888 -D 5115 user@host

Test it with curl like this:

curl --proxy socks5h://localhost:5115 http://private.example/contacts.html

Source: http://blog.sanctum.geek.nz/ssh-socks-and-curl/

share|improve this answer
    
Bingo! Thanks so much. Working now. –  fronzee Apr 3 '13 at 17:08

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.