Linux Mint Network Proxy Preferences doesn't affect command line apps?
Solution 1
Simply edit your /etc/profile
file with ie, nano:
sudo nano /etc/profile
and at the end of the file add
http_proxy="http://user:password@foo_server:port"
https_proxy="http://user:password@foo_server:port"
ftp_proxy="http://user:password@foo_server:port"
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.
Solution 2
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 :)
Solution 3
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=http://servidor-ip:port/
$ export http_proxy=http://127.0.0.1:3128/
$ export http_proxy=http://proxy.myempresa.com:3128/
Related videos on Youtube
gallardoelise2
Updated on September 18, 2022Comments
-
gallardoelise2 over 1 year
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?
-
MSIS almost 12 yearsSometimes just by restarting the terminal after configuring the proxy the modificaitons does apply automatically. If it doesn't apply what it's in the other comments :)
-
-
gallardoelise2 almost 12 yearsThis makes things like wget and curl work, and I'm guessing other tools that use HTTP specifically, but it still doesn't fix SSH / telnet. Is it supposed to, and this may just be an issue with the proxy/firewall I'm behind, or is there something else, or is what I want maybe just not possible in the scenario I'm in?
-
gallardoelise2 almost 12 yearsPlease see my comment on the other answers. This works for some things, not for others. Thanks!
-
Bruno Pereira almost 12 years@Joseph I think you need to use those programs options to force a proxy on them, other than that this is the best solution (and only as far as I know). I will edit the answer to include an example.
-
Unknowntiou almost 12 yearsA random app that's using another protocol than HTTP generally won't work over a HTTP proxy, unless that HTTP proxy supports HTTP CONNECT method, that is enabled in its settings and you are allowed to use this feature when you are connecting through proxy.