trzsz / trzsz-ssh

trzsz-ssh ( tssh ) is an ssh client designed as a drop-in replacement for the openssh client. It aims to provide complete compatibility with openssh, mirroring all its features, while also offering additional useful features. Such as login prompt, batch login, remember password, automated interaction, trzsz, zmodem(rz/sz), udp mode like mosh, etc.
https://trzsz.github.io/ssh
MIT License
1.74k stars 102 forks source link

Windows下无法使用`IdentityAgent`登录 #123

Closed lifei closed 4 months ago

lifei commented 4 months ago

ssh_config

Host s0* t0* x0*
    IdentityAgent /tmp/.ssh-agent.sock
    #!!IdentityAgent C:\Users\lifei\AppData\Local\Temp\.ssh-agent.sock

行为

> tssh t001
dial tcp [192.168.196.114:22] failed: dial tcp 192.168.196.114:22: i/o timeout
lifei commented 4 months ago

Warning: forward to agent [C:\Users\lifei\AppData\Local\Temp.ssh-agent.sock] failed: open C:\Users\lifei\AppData\Local\Temp.ssh-agent.sock: The process cannot access the file because it is being used by another process.

lonnywong commented 4 months ago

Windows 用 named pipe 的,一般不需要配置 IdentityAgent ,会默认连接 \\.\pipe\openssh-ssh-agent,你用的是 openssh 的 ssh agent ,还是其他的?

lifei commented 4 months ago

使用的ssh-pageantpageant

lifei commented 4 months ago

测了下ssh-agent好像是OK的

lonnywong commented 4 months ago

putty 的 pageant ?只要打开它,不要配置 IdentityAgent,自动就会连上它,你可以加 --debug 参数确认。

lifei commented 4 months ago

image image

lifei commented 4 months ago

debug: dial ssh agent [C:/Users/lifei/AppData/Local/Temp/ssh-STmq6S4ntPtr/agent.996] failed: The parameter is incorrect.

lifei commented 4 months ago

putty 的 pageant ?只要打开它,不要配置 IdentityAgent,自动就会连上它,你可以加 --debug 参数确认。

不配OK……

lonnywong commented 4 months ago

优先使用 ssh-agent,要关了它,才会尝试 pageant,不要配置任何 IdentityAgent。

lonnywong commented 4 months ago

Windows 一般不需要配置 IdentityAgent,如果要配置,也一般配置一个 Named Pipes,中文叫 命名管道

lonnywong commented 4 months ago

发现 Windows 也是支持 unix socket 的:

https://devblogs.microsoft.com/commandline/af_unix-comes-to-windows/

https://go-review.googlesource.com/c/sys/+/132555

我在下个版本支持一下,不过要求 ssh agent 自身要正确监听对应的 unix socket 。