Velvet Star Monitor

Standout celebrity highlights with iconic style.

news

Linux Mint Network Proxy Preferences doesn't affect command line apps?

Writer Andrew Mclaughlin

I am running Linux Mint 11 (Katya) with GNOME 2 and am behind a corporate proxy. I've gone into the Network Proxy Preferences and put in my auto-configuration URL, and this seems to work for things like Pidgin and Chrome (though not Thunderbird...), but it does not affect programs that I run from the terminal, e.g. ssh, telnet, git, et al. I have hit "Apply System-Wide..." button in Network Proxy Preferences, which prompts me for my password twice, but it doesn't seem to help.

Any thoughts?

1

3 Answers

Simply edit your /etc/profile file with ie, nano:

sudo nano /etc/profile

and at the end of the file add

http_proxy=""
https_proxy=""
ftp_proxy=""
export http_proxy ftp_proxy https_proxy

where foo_server is your proxy server, and port is the port you need to connect to your proxy server.

To check if the new settings are in use simple use type source /etc/profile and you can then check that the server is in use with (install curl if you don't have it yet)

curl icanhazip.com

that should return your proxy server's address.

Software like git, ssh, telnet, will tend to ignore those settings and use their own, I know that there are several utilities for ssh that allow you to do that. There wont be a unique, works for all way of doing it.

Maybe separate questions, regarding each service you want to use is a better option than asking for a global way of making it work, the short answer here would be: there is no global way.

3

Regarding Console Environment

Setting the various Environment variables, like the other answers suggest, is the way to go. I would also define upper case counterparts of all variables since some applications only recognize one or the other. Moreover, I would define NO_PROXY for hosts you don't want to proxy, eg.:

 export no_proxy="localhost,127.0.0.1,localaddress,.corporate.com"

Proxying SSH

This requires a bit more tweaking. There's a third party tool called 'connect' available here. Its homepage is here. It will allow you to proxy SSH connections over HTTPS and SOCKS proxies. However, it only supports basic authentication methods.

For this to work, you'll have to modify your ~/.ssh/config file to use 'connect' command as proxy command. Assuming your corporate SOCKS server is running at socks.corporate.com on port 1080, you can add ProxyCommand option in ~/.ssh/config, like this:

Host remote.outside.net ProxyCommand connect -S socks.corporate.com %h %p

The variables %h and %p will be replaced on invoking proxy command with target hostname and port specified to SSH command.

If you don't want to add a seperate HOST entry for every single target host, you can also use wildcards:

## Outside of the firewall, use connect command with SOCKS conenction.
Host * ProxyCommand connect -S socks.corporate.com %h %p
## Inside of the firewall, use connect command with direct connection.
Host *.socks.coporate.com ProxyCommand connect %h %p

Similarly, if you want to use https proxy, use -H option instead of -S option in example above, like this:

## Outside of the firewall, with HTTP proxy
Host * ProxyCommand connect -H proxy.corporate.com:8080 %h %p
## Inside of the firewall, direct
Host *.corporate.com ProxyCommand connect %h %p

Since you're in a corporate network it maybe a good idea to make sure your IT department if fine with you proxying SSH. Maybe they even have a better solution than mine. Otherwise you might end up on the blacklist and no connectivity at all :)

From the console prompt is very easy to use the http_proxy environment variable, which allows us to connect from the session / application in text mode to the internet.

Write the following command to configure the proxy server depending on your setup:

$ export http_proxy=
$ export http_proxy=
$ export http_proxy=
1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy