【发布时间】:2020-03-27 14:11:23
【问题描述】:
我在 Windows 上使用 Portable Git x64。我运行所有认为 Git Bash 的东西。我需要 ssh 到只能通过 HTTP 代理访问的服务器。服务器的身份验证是通过 pubkey,代理的身份验证是通过密码,用户名不同。我的~/.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 server登录:
$ 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
git-gui--askpass 在那里,但由于某种原因它没有被 ssh 接收。运行file '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
git-gui--askpass 的内容与https://github.com/git/git/blob/3bab5d56259722843359702bc27111475437ad2a/git-gui/git-gui--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。
关于如何使它工作的任何想法?
【问题讨论】:
-
为什么在log Executing proxy command里说被忽略?
-
“在日志中执行代理命令”是什么意思?如果我在 .ssh/config 中指定代理的密码,它会被 ssh 忽略,在日志中没有关于密码的任何内容,ssh 尝试弹出密码窗口并失败。
标签: ssh proxy mingw http-proxy