【问题标题】:ssh on windows through firewall (not putty)通过防火墙在 Windows 上 ssh(不是腻子)
【发布时间】:2019-10-30 17:12:48
【问题描述】:

我需要通过公司代理从我的 Win10 机器连接到 Ubuntu SSH 主机(不同端口 = 443 上的 12.34.56.78)。这必须通过命令行来完成,所以我可以使用 VS Code Insiders 的“Remove SSH”功能。

我在win10-client上创建了一个ssh-key,并将pub-key添加到了authorized_keys,但它不起作用:

PS C:\> ssh linuxuser@12.34.56.78 -p443  -o "ProxyCommand ssh.exe -p443 -X connect -x http://corporate-proxy:8080 %h %p" -v -o "IdentityFile C:\Users\win10user\.ssh\id_rsa"
OpenSSH_for_Windows_7.6p1, LibreSSL 2.6.4
debug1: Reading configuration data C:\\Users\\win10user/.ssh/config
debug1: C:\\Users\\win10user/.ssh/config line 1: Applying options for 12.34.56.78
debug1: Executing proxy command: exec ssh.exe -p443 -X connect -x http://corporate-proxy:8080 12.34.56.78 443
debug1: identity file C:\\Users\\win10user\\.ssh\\id_rsa type 0
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\win10user\\.ssh\\id_rsa-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_for_Windows_7.6
ssh_exchange_identification: Connection closed by remote host
ssh_exchange_identification: Connection closed by remote host

我错过了什么?

编辑:设置的路径/文件夹包含文件: 我还通过openssl rsa -in ~/.ssh/id_rsa -outform pem > id_rsa-cert 生成了 id_rsa-cert

PS M:\> ls  C:\\Users\\win10user\\.ssh\


    Directory: C:\Users\win10user\.ssh


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----       10/29/2019  10:18 AM            167 config
-a----       10/29/2019  10:07 AM           1766 id_rsa
-a----       10/29/2019  10:07 AM            415 id_rsa.pub
-a----       10/29/2019  11:02 AM           1675 id_rsa-cert


我找到了解决办法:

ProxyCommand C:\Users\win10suer\Nmap\ncat.exe --proxy proxy:8080 %h %p

【问题讨论】:

    标签: ssh openssh


    【解决方案1】:

    问题可能出在:

    debug1: key_load_public: No such file or directory
    

    尝试将密钥放在需要的目录中

    【讨论】:

    • 忘了说:这个文件夹里有一个键,这就是我明确设置路径的原因。 ``` PS C:\> ls C:\\Users\\win10user\\.ssh\ config id_rsa id_rsa.pub ```
    • 另一个想法,检查服务器上的 ~/.ssh/known_hosts。可能没有你的客户端ip?
    • ~/.ssh/known_hosts 不存在,因此我假设我的命令甚至没有到达我的主机。尝试连接时,“sudo tail -f /var/log/auth.log”也没有显示新行。
    • 也许您的代理正在本地搜索密钥? (我的意思是在代理服务器上)
    • 我认为问题不在于关键,而在于代理命令本身(它永远不会到达主机)。通过 http-proxy@8080 到 ssh-host@443 的命令是否正确?
    猜你喜欢
    • 1970-01-01
    • 2021-10-06
    • 2013-05-31
    • 1970-01-01
    • 1970-01-01
    • 2021-04-26
    • 1970-01-01
    • 2020-05-27
    • 2010-12-16
    相关资源
    最近更新 更多