How to set proxy for wget? – Stack Overflow
I want to download something with wget using a proxy:
HTTP Proxy: 127. 0. 1
The proxy does not need username and password.
How can I do this?
Dharman24. 1k20 gold badges62 silver badges112 bronze badges
asked Jun 26 ’12 at 16:21
For all users of the system via the /etc/wgetrc or for the user only with the ~/ file:
or via -e options placed after the URL:
wget… -e use_proxy=yes -e _proxy=127. 1:8080…
Azat Ibrakov7, 7259 gold badges34 silver badges41 bronze badges
answered Jun 26 ’12 at 16:27
amaksramaksr6, 8532 gold badges14 silver badges17 bronze badges
Type in command line:
$ export _proxy=proxy_host:proxy_port
for authenticated proxy,
$ export _proxy=username:password@proxy_host:proxy_port
and then run
$ wget fileurl
for, just use _proxy instead of _proxy. You could also put these lines in your ~/ file so that you don’t need to execute this everytime.
answered Sep 10 ’13 at 14:55
shivshnkrshivshnkr1, 30512 silver badges18 bronze badges
the following possible configs are located in /etc/wgetrc just uncomment and use…
# You can set the default proxies for Wget to use for,, and ftp.
# They will override the value in the environment.
#_proxy = #_proxy = #ftp_proxy =
# If you do not want to use proxy at all, set this to off.
#use_proxy = on
answered Jun 26 ’12 at 16:26
hovanessyanhovanessyan31. 3k7 gold badges55 silver badges77 bronze badges
wget uses environment variables somthing like this at command line can work:
export no_proxy=”localhost, 127. 1, localaddress,. ”
answered Nov 1 ’13 at 2:24
juan_ligajuan_liga3192 silver badges3 bronze badges
After trying many tutorials to configure my Ubuntu 16. 04 LTS behind a authenticated proxy, it worked with these steps:
$ sudo nano /etc/wgetrc
Uncomment these lines:
#_proxy = #_proxy = #ftp_proxy = #use_proxy = on
Change to username:password@domain:port/
IMPORTANT: If it still doesn’t work, check if your password has special characters, such as #, @,… If this is the case, escape them (for example, replace passw@rd with passw%40rd).
jaume3411 gold badge4 silver badges10 bronze badges
answered Jan 4 ’17 at 14:41
In Debian Linux wget can be configured to use a proxy both via environment variables and via wgetrc. In both cases the variable names to be used for HTTP and HTTPS connections are
Note that the file /etc/wgetrc takes precedence over the environment variables, hence if your system has a proxy configured there and you try to use the environment variables, they would seem to have no effect!
answered Apr 18 ’16 at 16:02
a1ana1an3, 0745 gold badges34 silver badges50 bronze badges
If you need to execute wget just once with the proxy, the easiest way is to do it with a one-liner like this:
_proxy=username:password@proxy_host:proxy_port wget fileurl
or with an target URL:
answered Apr 8 ’19 at 13:39
jplandrainjplandrain2, 0984 gold badges23 silver badges21 bronze badges
As all others explained here, these environment variable helps to pass on proxies.
Note: But please not that if the password contains any special character then that needs to be configured as%
Example: If the password is pass#123, need to be used as pass%23123 in above export commands.
answered Feb 21 ’19 at 14:16
rashokrashok11k11 gold badges81 silver badges93 bronze badges
In Windows – for Fiddler say – using environment variables:
set _proxy=set _proxy=
answered Jul 8 ’14 at 11:33
fiatfiat14. 1k7 gold badges73 silver badges97 bronze badges
start wget through socks5 proxy using tsocks:
install tsocks: sudo apt install tsocks
# vi /etc/
server = 127. 1
server_type = 5
server_port = 1080
start: tsocks wget url_to_get
answered May 7 ’20 at 7:48
Gavin GaoGavin Gao1692 silver badges5 bronze badges
Not the answer you’re looking for? Browse other questions tagged linux proxy wget or ask your own question.
can you set socks5 proxy from Linux command line? – Ask …
I’ve managed to set a socks5 proxy server from Linux towards another server like this:
ssh -D 9090 -N -f user@192. 168. 76. 102
Then I changed the settings in mozilla browser to use the socks proxy, and it works, I can surf the internet. What I want do is to set this setting in Linux command line, so I can have access to the internet from there, like so: wget.
First I tried editing the /etc/environmental file:
export _proxy=socks5127. 0. 1:9090
But it doesn’t work:
Error parsing proxy URL socks5127. 1:9090: Unsupported scheme ‘socks5’.
Then I installed proxychains4, and added in /etc/:
socks5 127. 1 9090
But still doesn’t work:
Resolving ()… failed: Temporary failure in name resolution.
wget: unable to resolve host address ‘
Do you have any ideas how I can make this work?
Socks5 proxy and wget – Mufljuz.com
Skip to content
I’ve tried to set wget bash loop over socks5 proxy and was surprised to find out that wget does not have included proxy support. First start your proxy tunnel on port 8080 with
ssh -o “ServerAliveInterval 60” -o “ServerAliveCountMax 3” -f -C -N -D *:8080 &>
My firefox utilizes this tunnel perfectly – the proxy config page has the following entries:
Manual proxy configuration:
SOCKS Proxy 127. 0. 1 Port 8080
“SOCKS v5” checked
Initially I’ve tried using wget –execute to set _proxy with
wget -e “_proxy = 127. 1:8080” “url_to_get”
however it didn’t work giving me the following error.
Connecting to 127. 1:8080… connected.
Proxy request sent, awaiting response… No data received.
Wget with Tsocks
The solution was to install tsocks. For gentoo just do
emerge -av tsocks
and modify the config file. Note that gentoo keeps the confing information in /etc/socks/, while ubuntu keeps it in /etc/
nano -w /etc/socks/
server = 127. 1
server_type = 5
server_port = 8080
If you used proxy on earlier versions of wget, remove any proxy cmds from ~/
Finally start your wget trough socks5 proxy using tsocks
tsocks wget url_to_get
starting two tsocks wget at the same time caused my system to slow down and gave me the following error:
Connecting to ||:443… failed:
Transport endpoint is not connected.
After killing one of the processes, I got back my cpu.
Do you wanna do more? Try Tor.