Difference between revisions of "Linux proxy"
Line 1: | Line 1: | ||
= Linux proxy settings = | |||
When you behind a firewall of a company proxy you may need to configure your Linux distro to pass proxy details to the applications in turn to connect to Internet. Most common application like curl, wget, git use an environment variables to know proxy settings but others like Firefox and desktop applications may need to be specifically configured within application itself. | When you behind a firewall of a company proxy you may need to configure your Linux distro to pass proxy details to the applications in turn to connect to Internet. Most common application like curl, wget, git use an environment variables to know proxy settings but others like Firefox and desktop applications may need to be specifically configured within application itself. | ||
In the examples below depends on your proxy server you need to be authentication. Often it could be your own Active Directory login/password combination but it can be also Internet user login/password credentials. | In the examples below depends on your proxy server you need to be authentication. Often it could be your own Active Directory login/password combination but it can be also Internet user login/password credentials. | ||
; | ;Proxy environment variables | ||
http_proxy = | http_proxy=<nowiki>http://example.com</nowiki> | ||
https_proxy =$http_proxy or https_proxy = URL | https_proxy=$http_proxy or https_proxy=URL | ||
ftp_proxy = URL | ftp_proxy=URL | ||
no_proxy = string | no_proxy=string | ||
Make sure you can resolve the proxy server DNS name otherwise | Make sure you can resolve the proxy server DNS name otherwise use IP address | ||
; | ;Proxy temporary configuration for a single command only | ||
<nowiki>sudo env http_proxy=http://proxyserver.local:8080 apt-get update</nowiki> | <nowiki>sudo env http_proxy=http://proxyserver.local:8080 apt-get update</nowiki> | ||
<nowiki>sudo env http_proxy=http://username:password@10.0.0.1:8080 apt-get update</nowiki> | <nowiki>sudo env http_proxy=http://username:password@10.0.0.1:8080 apt-get update</nowiki> | ||
; | ;Proxy temp configuration for duration of a session. With sudo remember to use -E to preserve local environment variables | ||
<nowiki>export http_proxy=http://proxyserver.local:8080/</nowiki> | <nowiki>export http_proxy=http://proxyserver.local:8080/</nowiki> | ||
<nowiki>export ftp_proxy=http://username:password@proxyserver.local:8080/</nowiki> | <nowiki>export ftp_proxy=http://username:password@proxyserver.local:8080/</nowiki> | ||
sudo -E apt-get update | sudo -E apt-get update | ||
;Permanent | ;Permanent proxy configuration for a user | ||
Append enviroment variables to ~/.profile | Append proxy enviroment variables to a user <code>~/.profile</code> file. With sudo remember to use -E to preserve local environment variables | ||
<nowiki>http_proxy=http://proxyserver.local:8080/</nowiki> | <nowiki>http_proxy=http://proxyserver.local:8080/</nowiki> | ||
;Manage local environment variables | ;Manage local environment variables | ||
Line 30: | Line 31: | ||
exec bash #unset all local variables back to default on login | exec bash #unset all local variables back to default on login | ||
= Applications custom proxy setting = | |||
== Wget == | |||
Some proxy servers require authorization to enable you to use them. The authorization consists of ''username'' and ''password'', which must be sent by eg. Wget. As with HTTP authorization, several authentication schemes exist. For proxy authorization only the ''Basic authentication'' scheme is currently implemented. | Some proxy servers require authorization to enable you to use them. The authorization consists of ''username'' and ''password'', which must be sent by eg. Wget. As with HTTP authorization, several authentication schemes exist. For proxy authorization only the ''Basic authentication'' scheme is currently implemented. | ||
You may specify your username and password either through the proxy URL or through the command-line options. Assuming that the company’s proxy is located at | You may specify your username and password either through the proxy URL or through the command-line options. Assuming that the company’s proxy is located at 'proxy.company.com' at port 8001, a proxy URL location containing authorization data might look like this: | ||
<nowiki>wget http://username:mypassword@proxy.company.com:8001/</nowiki> | <nowiki>wget http://username:mypassword@proxy.company.com:8001/</nowiki> | ||
Alternatively, you may use the '''proxy-user''' and '''proxy-password''' options, and the equivalent .wgetrc settings '''proxy_user''' and '''proxy_password''' to set the proxy username and password. | Alternatively, you may use the '''proxy-user''' and '''proxy-password''' options, and the equivalent .wgetrc settings '''proxy_user''' and '''proxy_password''' to set the proxy username and password. | ||
= Proxy servers = | |||
== CNTLM == | |||
= Resources = | = Resources = | ||
*[http://askubuntu.com/questions/158557/setting-proxy-from-terminal setting-proxy-from-terminal] | *[http://askubuntu.com/questions/158557/setting-proxy-from-terminal setting-proxy-from-terminal] | ||
*[http://cntlm.sourceforge.net/ Cntlm Authentication Proxy] NTLM / NTLM Session Response / NTLMv2 authenticating HTTP proxy intended to help you break free from the chains of Microsoft | *[http://cntlm.sourceforge.net/ Cntlm Authentication Proxy] NTLM / NTLM Session Response / NTLMv2 authenticating HTTP proxy intended to help you break free from the chains of Microsoft |
Revision as of 19:53, 18 May 2016
Linux proxy settings
When you behind a firewall of a company proxy you may need to configure your Linux distro to pass proxy details to the applications in turn to connect to Internet. Most common application like curl, wget, git use an environment variables to know proxy settings but others like Firefox and desktop applications may need to be specifically configured within application itself.
In the examples below depends on your proxy server you need to be authentication. Often it could be your own Active Directory login/password combination but it can be also Internet user login/password credentials.
- Proxy environment variables
http_proxy=http://example.com https_proxy=$http_proxy or https_proxy=URL ftp_proxy=URL no_proxy=string
Make sure you can resolve the proxy server DNS name otherwise use IP address
- Proxy temporary configuration for a single command only
sudo env http_proxy=http://proxyserver.local:8080 apt-get update sudo env http_proxy=http://username:password@10.0.0.1:8080 apt-get update
- Proxy temp configuration for duration of a session. With sudo remember to use -E to preserve local environment variables
export http_proxy=http://proxyserver.local:8080/ export ftp_proxy=http://username:password@proxyserver.local:8080/ sudo -E apt-get update
- Permanent proxy configuration for a user
Append proxy enviroment variables to a user ~/.profile
file. With sudo remember to use -E to preserve local environment variables
http_proxy=http://proxyserver.local:8080/
- Manage local environment variables
unset HTTP_PROXY #unset HTTP_PROXY single variable env -i bash #unset all local variables back to default on login exec bash #unset all local variables back to default on login
Applications custom proxy setting
Wget
Some proxy servers require authorization to enable you to use them. The authorization consists of username and password, which must be sent by eg. Wget. As with HTTP authorization, several authentication schemes exist. For proxy authorization only the Basic authentication scheme is currently implemented.
You may specify your username and password either through the proxy URL or through the command-line options. Assuming that the company’s proxy is located at 'proxy.company.com' at port 8001, a proxy URL location containing authorization data might look like this:
wget http://username:mypassword@proxy.company.com:8001/
Alternatively, you may use the proxy-user and proxy-password options, and the equivalent .wgetrc settings proxy_user and proxy_password to set the proxy username and password.
Proxy servers
CNTLM
Resources
- setting-proxy-from-terminal
- Cntlm Authentication Proxy NTLM / NTLM Session Response / NTLMv2 authenticating HTTP proxy intended to help you break free from the chains of Microsoft