Search code examples
unixproxycygwinwget

Proxy authentication using wget on cygwin


My institute recently installed a new proxy server for our network. I am trying to configure my Cygwin environment to be able to run wget and download data from a remote repository.

Browsing the internet I have found two different solutions to my problem, but no one of them seem to work in my case.

The first one I tried was to follow these instructions, so in Cygwin:

cd /cygdrive/c/cygwin64/etc/
nano wgetrc

at the end of the file, I added:

use_proxy = on
http_proxy=http://username:[email protected]:my.port/
https_proxy=https://username:[email protected]:my.port/
ftp_proxy=http://username:[email protected]:my.port/

(of course, using my user and password)

The second approach was what was suggested by this SO post, so in my Cygwin environment:

export http_proxy=http://username:[email protected]:my.port/
export https_proxy=https://username:[email protected]:my.port/
export ftp_proxy=http://username:[email protected]:my.port/

in both cases, if I try to test my wget, I get the following:

$ wget http://www.google.com
--2020-01-30 12:12:22--  http://www.google.com/
Resolving my.proxy.ip (my.proxy.ip)... 10.1XX.XXX.XX
Connecting to my.proxy.ip (my.proxy.ip)|10.1XX.XXX.XX|:8XXX... connected.
Proxy request sent, awaiting response... 407 Proxy Authentication Required
2020-01-30 12:12:22 ERROR 407: Proxy Authentication Required.

It looks like if my user and password are not ok, but I actually checked them on my browsers and my credentials work just fine.

Any idea on what this could be due to?


Solution

  • This problem was solved thanks to the suggestion of a User of the community AskUbuntu.

    Basically, instead of editing the global configuration file wgetrc, I should have created a new .wgetrc with my proxy configuration in my Cygwin home directory.

    In summary:

    Step 1 - Create a .wgetrc file;

    nano ~/.wgetrc
    

    Step 2 - record in this file the proxy info:

    use_proxy=on
    http_proxy=http://my.proxy.ip:my.port
    https_proxy=https://my.proxy.ip:my.port
    ftp_proxy=http://my.proxy.ip:my.port
    proxy_user=username
    proxy_password=password