407 proxy authentication required linux

407 Authentication required npm

Hello everyone I´ve been trying to configure and use npm on my enterprise PC without success. I´ve set proxy, https-proxy, strict-ssl false, registry http://registry.npmjs.org proxy has been set like this «http://user:password@proxy_ip:proxy:port» Where the password has a special character written in urlencode.

returns proxy with credentials as they should be. I have cleared my npm cache and tried again. No success. Any ideas what can be the problem?

Go to C:\Users\Your User\AppData\Roaming and delete the npm folder, then do the following command: npm cache clear —force and npm cache verify and then execute this command: npm i -g npm@latest —verbose .

9 Answers 9

I recommend reading through this article to configure the proxy for npm. http://wil.boayue.com/blog/2013/06/14/using-npm-behind-a-proxy/

  • npm config set proxy http://proxy.company.com:proxyport
  • npm config set http-proxy http://proxy.company.com:proxyport
  • npm config set https-proxy http://proxy.company.com:proxyport

Hope this is useful for you!

Thank you Suhas i have already found the solution as lautit said the domain was left in my proxy configuration. I have read quite a lot before asking but couldn´t fix the problem

use encodeURIComponent to generate encoded password. developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/… and output of encodeURIComponent stuff into username:encodedpass@proxy.com

Usually, when you are behind a corporate proxy, it is needed to add the domain where you are at. Given that also the characters should be URL encoded, it would look like:

use encodeURIComponent to generate encoded password. developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/… and output of encodeURIComponent stuff into username:encodedpass@proxy.com

We should add proxy with username and password to avoid this error. For example:

npm config set proxy http://admin:admin123@172.10.3.21:3128 npm config set https-proxy http://admin:admin123@172.10.3.21:3128 

Is there no way to do this than to expose password like this? I was hoping on Windows machine ‘Credential manager’ would work, but it does not!

Editing the .npmrc file in user folder worked for me. I set the proxy and npm registry as follows:

proxy=http://username:password@proxy:port/ https-proxy=http://username:password@proxy:port registry=http://registry.npmjs.org/ 

Note : for usenames and passwords containing special charcters, the characters need to be encoded in the proxy configuration. e.g if username is «user» and password is «1234@user», then the .npmrc file will look like :

proxy=http://user:1234%40user@proxy:port/ https-proxy=http://user:1234@user@proxy:port registry=http://registry.npmjs.org/ 

where, %40 is the encoded form of «@». In my case, the pound symbol(#) was not getting accepted in username or password(Dont know why).

Читайте также:  Killing process by name in linux

Источник

Требуется 407 прокси-аутентификация

Когда я пытаюсь установить программное обеспечение с помощью Ubuntu Software Center, я получаю:

Failed to download repository information Check Your Internet connection 

Когда я пытаюсь сделать apt-get install something , Я получил:

407 Proxy Authentication Required 

Я использую прокси-сервер, который требует имя пользователя и пароль. Я установил свой системный прокси-сервер вручную, подключив необходимые номера в сетевой прокси-сервер и применив его в масштабе всей системы. Я думаю, что проблема сейчас заключается в подключении моего имени пользователя и пароля.

Когда я использую ИНТЕРНЕТ через Mozilla, он запрашивает у меня имя пользователя и пароль.

11 ответов

Чтобы ваш apt-get заработал, вы должны отредактировать файл конфигурации apt:

sudo -H gedit /etc/apt/apt.conf 

И добавить Acquire::http::Proxy «http://username:[email protected]:port/»;

Синтаксис, показанный выше, должен строго соблюдаться.

Эта конфигурация может потерпеть неудачу, если ваше имя пользователя или пароль содержит «@». Вы также можете добавить настройки прокси для других протоколов, таких как FTP.

Обновление: если ваше имя пользователя или пароль содержит «@», вы можете заменить его на%40. Пример: Если ваш пароль @123 введите это как %40123 ,

Для других символов см. Это процентное кодирование

Сначала настройте параметры прокси-сервера с помощью мастера использования Linux вручную и примените настройки в масштабе всей системы, как в этом окне мастера.

Добавьте свою среду прокси. Это просто пример настроек.
Откройте вход в командную строку и отредактируйте файл apt.conf:

Уже есть 4 строки кода, начинающиеся с ключевого слова Acquire, отредактируйте его так:

Acquire::http::Proxy "http://username:[email protected]:port/"; Acquire::https::Proxy "https://username:[email protected]:port/"; Acquire::ftp::Proxy "ftp://username:[email protected]:port/"; 

Заметка
Если ваш пароль содержит специальные символы, такие как @,$,! (например, Пароль: [email protected]), затем замените специальные символы их эквивалентами в шестнадцатеричном коде с префиксом% следующим образом:

Если вы используете корпоративный прокси-сервер, на котором выполняется аутентификация NTLM, вы можете использовать CNTLM:

$ sudo apt-get install cntlm $ sudo vi /etc/cntlm.conf 

Изменить настройки по умолчанию (домен, имя пользователя, пароль и прокси). Затем перезапустите сервис:

$ sudo /etc/init.d/cntlm restart 

Теперь вы можете использовать localhost:3128 (порт CNTLM по умолчанию) в качестве общесистемного прокси для Ubuntu.

Если ваше имя пользователя разделено пробелом, используйте:

Если ваше имя пользователя не разделено пробелами, используйте:

Разница заключается в добавлении открытия и закрытия ‘ ,

В последних версиях Ubuntu вы можете использовать Системные настройки> Сеть> Сетевой прокси, и когда вы нажимаете «apply system wide» он изменяет настройки прокси в разных местах, по крайней мере, включая /etc/apt/sources.list файл, ОДНАКО.

У него нет механизма для запроса аутентификации. Понятия не имею, почему никто еще не сделал эту часть, но из-за этого, если вам нужна аутентификация, вам нужно также указать свой пароль и имя пользователя в этом формате:

Читайте также:  Linux debian файлы конфигурации

Источник

Heroku toolbelt fails to install with 407 (Ubuntu/Precise)

Usually a 407 Proxy Authentication Required error while attempting to install a package with APT means:

If that is the case here, then you can solve the problem by adding the line

Acquire::http::Proxy "http://user:pass@proxy:port/";

to the file /etc/apt/apt.conf (give user , pass , proxy , and port the correct values).

A Curious Situation

Here, it appears other software sources work. apt-get is able to read data from archive.ubuntu.com , and presumably is able to do more (as you would’ve noticed if the package manager on your Ubuntu box were thoroughly broken).

So while the problem seems proxy-related, it may not be a consequence of misconfiguration on your machine.

One interesting thing about the http://toolbelt.heroku.com software source is that navigating to that URL forwards you to the HTTPS site. APT fully supports HTTPS software sources, but this software source is not HTTPS.

Examining the configuration for the software source the script enabled reveals:

$ cat /etc/apt/sources.list.d/heroku.list deb http://toolbelt.heroku.com/ubuntu ./ 

http://toolbelt.heroku.com/ubuntu goes to an HTTPS 404 page, too, but with a trailing slash, it does not. When ended in / , it redirects to http://heroku-toolbelt.s3.amazonaws.com/apt/ (which, conveniently though perhaps irrelevantly, behaves correctly whether or not you have the trailing / ).

Maybe Ubuntu or your proxy is having a hard time figuring out what is HTTP and HTTPS, for proxy purposes. This is just a guess. but one that I think is worth checking out.

A Possible Solution

Edit /etc/apt/sources.list.d/heroku.list and change its contents to:

deb http://toolbelt.heroku.com/ubuntu/ ./ 

(That is, add a trailing slash to the URL.)

Then run sudo apt-get update and see if the error goes away. If it does, try installing Heroku.

  • The script you download would’ve automatically installed it, but it didn’t get to that point. So manually run: sudo apt-get install heroku

Why not just change it to the amazonaws domain name?

When I suggested to add a trailing slash, you probably wondered why I didn’t just say to change the line to:

deb http://heroku-toolbelt.s3.amazonaws.com/apt ./ 

The reason is that, even though a Packages file (listing packages the repository offers) exists in http://heroku-toolbelt.s3.amazonaws.com/apt and can be downloaded with

wget http://heroku-toolbelt.s3.amazonaws.com/apt/./Packages 

. nonetheless, somehow apt-get update is unable to download the file:

W: Failed to fetch http://heroku-toolbelt.s3.amazonaws.com/apt/./Packages 404 Not Found 

aptitude has the same problem, suggesting it’s not an apt-get bug. Moreover, the ./ syntax works fine for other files besides Packages that are retrieved by apt-get update and aptitude update .

Читайте также:  Dell precision with linux

Therefore, unless this is enough information that you (or someone) can figure out what I cannot, it’s not likely changing it to the amazonaws domain name will work either.

Manually Download and Install the .deb Packages

If your proxy settings are correct and there is no problem with your proxy itself, and adding the trailing slash to the URL did not work, then the only solution I can think of is the workaround of manually downloading and installing the .deb packages.

First, disable the Heroku repository that’s causing errors:

cd /etc/apt/sources.list.d && sudo mv heroku.list heroku.list.save 

The Packages file (in case you’re not able to download it at all) says:

Package: foreman Priority: standard Section: main Maintainer: Heroku Architecture: all Version: 0.60.0 Depends: ruby1.9.1 Filename: ./foreman-0.60.0.deb Size: 89486 MD5sum: 83c614451545d98a09d0bb55e939cc03 SHA1: afd5d9d6ede750cb42bce1ab938dd9ac7bebe100 SHA256: a41532cb9ed60226ca9b4388842215c5ba94f8f5c32d832519858f66d5b19ebe SHA512: c9327af190b12cb4d7f33cf2480c15c1249b400c4605ea5405ba3e3ddd433789a94471946ef4be452ed1669f1b63bf7150dba03c0e76a0d6f9c9ff981890490a Description: Manage Procfile-based applications. Foreman is a manager for Procfile-based applications. Its aim is to abstract away the details of the Procfile format, and allow you to either run your application directly or export it to some other process management format. Package: heroku-toolbelt Priority: standard Section: main Installed-Size: Maintainer: Heroku Architecture: all Version: 2.34.0 Depends: git-core, foreman, heroku (= 2.34.0) Filename: ./heroku-toolbelt-2.34.0.deb Size: 628 MD5sum: e81597804c537e93f85b89720ae2ebfd SHA1: ebbb60c1479364f112ea386b5f6199de54dfcf5f SHA256: c204b87691a5fdd8e0b750512e557ac5c494d4d561ecafb1e6d2c04b078b4bf8 SHA512: 8622e839f4748878a3c3083b09d1a84a16fb0c8c6cd3ac0885e5960810e8116c785e63027ccf87bfd1618be53736dabbcfc47c9c83e072776e9099c5443a64f9 Description: A metapackage for working with the Heroku platform. Package: heroku Priority: standard Section: main Maintainer: Heroku Architecture: all Version: 2.34.0 Depends: ruby1.9.1, libopenssl-ruby1.9.1, libreadline-ruby1.9.1, libssl0.9.8 (>= 0.9.8k) | libssl1.0.0 Filename: ./heroku-2.34.0.deb Size: 639186 MD5sum: 474461b8217d45a954fc0eeab007b53d SHA1: 50f2ca475d78d480a47dcc56353707c69209dbb9 SHA256: 7caf91c66e6c439b210b338a06313218b8a38ce5458467771f51df770832c476 SHA512: d009fb299232dc65ce586fe185670d96c1cf30bf15e7dada1f11000e7753951dc77b872caca0897e856a88fe3142f2da9f63b90adaeca213bacdb73455c8c1f1 Description: Client library and CLI to deploy apps on Heroku. 

So, make an empty directory, grab the debs, and install them and their dependencies:

mkdir ~/heroku-debs cd ~/heroku-debs wget http://toolbelt.heroku.com/ubuntu/foreman-0.60.0.deb wget http://toolbelt.heroku.com/ubuntu/heroku-toolbelt-2.34.0.deb wget http://toolbelt.heroku.com/ubuntu/heroku-2.34.0.deb # You may want to verify hashes now. Ideally, download the Packages file # yourself, rather than assuming the authenticity of what I've quoted here. sudo dpkg -i *.deb sudo apt-get update && sudo apt-get -f install 

Remember they won’t be updated automatically when your other software is. However, assuming you’re able to download the Packages file, you can use that to check for updates from time to time.

I hope one of the earlier solutions I’ve presented worked for you. If not, this should, and hopefully a less ugly solution will be found soon.

Источник

Оцените статью
Adblock
detector