Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/image/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在使用mingw64的Windows上,通过HTTP代理使用密码进行SSH_Ssh_Proxy_Mingw_Http Proxy - Fatal编程技术网

在使用mingw64的Windows上,通过HTTP代理使用密码进行SSH

在使用mingw64的Windows上,通过HTTP代理使用密码进行SSH,ssh,proxy,mingw,http-proxy,Ssh,Proxy,Mingw,Http Proxy,我在Windows上使用便携式Git x64。我经营着Git Bash认为的一切。我需要ssh到一个只能通过HTTP代理访问的服务器。服务器的身份验证是通过公钥进行的,代理的身份验证是通过密码进行的,用户名是不同的。我的~/.ssh/config: Host server Hostname server_hostname User server_username IdentityFile ~/.ssh/id_rsa ProxyCommand /c/PortableGit/ming

我在Windows上使用便携式Git x64。我经营着Git Bash认为的一切。我需要ssh到一个只能通过HTTP代理访问的服务器。服务器的身份验证是通过公钥进行的,代理的身份验证是通过密码进行的,用户名是不同的。我的
~/.ssh/config

Host server
  Hostname server_hostname
  User server_username
  IdentityFile ~/.ssh/id_rsa
  ProxyCommand /c/PortableGit/mingw64/bin/connect.exe -H proxy_username@proxy_ip:12345 %h %p
当ssh试图弹出需要输入HTTP代理密码的窗口时,问题就开始了,请从
ssh-vvv服务器
登录:

$ ssh -vvv server
OpenSSH_7.9p1, OpenSSL 1.1.1a  20 Nov 2018
debug1: Reading configuration data /c/Users/username/.ssh/config
debug1: /c/Users/username/.ssh/config line 1: Applying options for server
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Executing proxy command: exec /c/PortableGit/mingw64/bin/connect.exe -H proxy_username@proxy_ip:12345 server_hostname 22
debug1: identity file /c/Users/username/.ssh/id_rsa type 0
debug1: identity file /c/Users/username/.ssh/id_rsa-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.9
'C:\PortableGit\mingw64\libexec\git-core\git-gui--askpass' is not recognized as an internal or external command,
operable program or batch file.
FATAL: Cannot decide password for proxy authentication.ssh_exchange_identification: Connection closed by remote host
gitgui-askpass
在那里,但由于某些原因ssh无法获取它。运行
文件“C:\PortableGit\mingw64\libexec\git core\git gui--askpass”
给出:

$ file 'C:\PortableGit\mingw64\libexec\git-core\git-gui--askpass'
C:\PortableGit\mingw64\libexec\git-core\git-gui--askpass: POSIX shell script, ASCII text executable
GitGUI的内容--askpass

我尝试通过命令行运行此脚本,效果良好:

此外,我还尝试将另一个程序指定为
SSH_ASKPASS=/mingw64/libexec/git core/git ASKPASS.exe
(我认为这样做很愚蠢)。这也不起作用:

...
fatal: failed to acquire credentials.
我试图在
~/.ssh/config
中提供密码,如下所示:

ProxyCommand /c/PortableGit/mingw64/bin/connect.exe -H proxy_username:proxy_password@proxy_ip:12345 %h %p
                                                                     ^^^^^^^^^^^^^^^
但是ssh忽略了这一点

此外,我尝试通过MobaXterm进行连接,这完全正常——有人要求我输入代理密码,输入后我就连接上了。另外,在MobaXterm中连接后,我可以在命令行中连接,因为代理在一段时间内不会要求密码。但由于另一个原因,我不能使用MobaXterm


关于如何使其工作有什么想法吗?

尝试将密码保存在
~/.ssh/config
文件中,然后添加

unset SSH_ASKPASS

到您的.bashprofile

实用程序connect.exe使用HTTP\u PROXY\u用户和HTTP\u PROXY\u密码环境变量。在

中找到的解决方案如果它在日志执行代理命令中,为什么说它被忽略?您所说的“它在日志执行代理命令中”是什么意思?如果我在.ssh/config中为代理指定密码,ssh将忽略该密码,在日志中,密码没有任何内容,ssh尝试弹出密码窗口,但失败。今天尝试了您的建议。基本上在这种情况下不会发生任何事情,当它需要请求代理传递时会挂断,我假设它会忽略配置中的密码。我最终使用了putty,有一个选项可以为代理指定密码。。