ssh through a proxy (Squid, etc)
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.
Thanks, I’m going to try this at school :o)
analog_
Wed, 2010-01-13 at 10:00:13