The Lumber Room

"Consign them to dust and damp by way of preserving them"

ssh through a proxy (Squid, etc)

with one comment

If you are somewhere where the only way of connecting to the outside world is through a proxy, then to get ssh to work, here’s what to do:

Get connect.c.

Compile it (gcc connect.c -o connect), and put connect somewhere in your path. That page says /usr/local/bin, but you probably don’t have permissions to that, anyway. You can do mkdir -p ~/bin && mv connect ~/bin and add a line export PATH=$PATH:~/bin to ~/.bashrc or ~/.bash_profile (or both), and restart the terminal, or start a new one.

Edit the file ~/.ssh/config (create it if it doesn’t exist) and add the two lines

Host *
  ProxyCommand connect -H proxyusername@proxyname:3128 %h %p

Replace proxyusername by the username for the proxy, and proxyname by the location of the proxy, and 3128 by the port number (it’s usually 3128 for Squid).

If it is a low-security thing and the password is already well-known (guest account?), then might as well put the password in the above .bash… files, to save the hassle of typing it each time:
export HTTP_PROXY_PASSWORD=proxypassword

Then ssh should work as usual: ssh username@hostname , etc.

Written by S

Tue, 2006-12-19 at 13:40:58

Posted in compknow

One Response

Subscribe to comments with RSS.

  1. Thanks, I’m going to try this at school :o)


    Wed, 2010-01-13 at 10:00:13

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.