Proxy authentication for commandline in Windows

19,677

Solution 1

The command line is not the one in charge of HTTP authentication - it is the program you run from the command line. There is no setting that would work for all command line run programs.

Solution 2

This is kind of an old question, but I came across it and saw it didn't have an accepted answer, so I'll give some feedback in case anyone else stumbles across this question.

I had to authenticate myself with a corporate proxy using the command line so I could install some Rubygems. I used

set http_proxy=http://username:[email protected]:80

I'm not sure why the proxy server didn't recognize me even though I was logged into my corporate account, but I needed to re-authenticate myself, and that worked for me. After using that command, I could download the Rubygems. It does require you to type your password in plaintext, and that will appear in plaintext to anyone doing a packet capture during your session. Maybe someone can suggest a way to feed in credentials securely?

Share:
19,677

Related videos on Youtube

hasanatkazmi
Author by

hasanatkazmi

Updated on September 17, 2022

Comments

  • hasanatkazmi
    hasanatkazmi over 1 year

    I am accessing web (port 80) using a proxy server which requires authentication. For web browser, it pops a window where I can enter my username and password but when I am using command-line (cmd) and try to run a program which uses web, no authentication window is poped and it says that authentication fails. I have entered proxy address in IE which the whole system uses but how can I find some alternative to authentication window for command-line?

    • Zoredache
      Zoredache almost 14 years
      What program are you using? Some tools like wget/curl will allow you to pass the proxy auth credentials.
  • DarcyThomas
    DarcyThomas about 8 years
    Was this on windows or linux?
  • Shwheelz
    Shwheelz about 8 years
    That one is Windows. Linux / Mac should look something like this: export HTTP_PROXY=username:[email protected]:80 (or replace 80 with whichever port your proxy uses)
  • DarcyThomas
    DarcyThomas about 8 years
    @shweelz Answer seems to indicate otherwise
  • DarcyThomas
    DarcyThomas about 8 years
    I assume that would only last until the end of the session & presumably if it set that in the global envrioment variables it would work for all sessions (yes that would mean storing my password in plain text == bad) Do you know if it would also apply to desktop apps as well? (Will test for my self on monday)
  • Ofir
    Ofir about 8 years
    That would only work for applications using the WinHTTP API
  • Ofir
    Ofir about 8 years
    @DarcyThomas - That would only work for applications using the WinHTTP API