|English: Xfce Terminal. on Debian Lenny. 日本語: Xfce Terminal。Debian Lennyで。 (Photo credit: Wikipedia)|
In this post, I will explain you how to configure the default proxy for bash in Debian. I often see questions about this in forums, so I hope it will help. If so, I would love to see links pointing to this article: it will help others find it more easily thanks to a better ranking in Google search. Thanks!
Setting up the proxy globallyYou can set the proxy globally in the files:
In this file you can specify the proxy for a given application for instance (see http://askubuntu.com/questions/158557/setting-proxy-from-terminal):
For bashIt's possible to specify the proxy in bash directly:
sudo env http_proxy=http://10.1.3.1:8080
Or in your .bashrc profile (not advised as it may not be taken into account by some applications):
export http_proxy=http://username:password@proxyhost:port/ export ftp_proxy=http://username:password@proxyhost:port/
For aptitude (apt-get)If you want to set the proxy for apt, the proper way is to edit /etc/apt/apt.conf and add:
For pip / easy_installFor pip, you can use the --proxy option to specify a proxy:
pip install toto --proxy "user:firstname.lastname@example.org:port" pip install toto --proxy "example.com:1080"
|English: Diagram of an open forward proxy. (Photo credit: Wikipedia)|
You can use ssh through a SOCKS proxy, but you need to install a few tools:
sudo apt-get install connect-proxy man connect-proxy vim ~/.ssh/config
In this configuration file, you specify which proxy you want to use for which hosts. For example, on this site, they provide the following configuration sample:
## Outside of the firewall, with HTTPS proxy Host my-ssh-server-host.net ProxyCommand connect -H proxy.free.fr:3128 %h 443 ## Inside the firewall (do not use proxy) Host * ProxyCommand connect %h %p
Note the -S command, that is used for SOCKS proxy (-H) is for HTTP proxies, for example:
ProxyCommand /usr/bin/connect-proxy -4 -S pproxy:port %h %p
SANS institute published a good article about all what you can do with SSH trough a proxy :)
If you have liked this article, please put a link to it on your Google+ profile are any other kind of web site: it will help others find it in the search engines. Thanks!