Git Product home page Git Product logo

Comments (19)

huangming avatar huangming commented on August 25, 2024 2

经过查询确认,应该是windows的openssh组件是有问题的,keepassxreboot/keepassxc#4681,我现在用了另外一个ssh-agent和ssh工具,测试成功了,用的是git-bash里面的ssh和OmniSSHAgent
配置的时候 ~/.ssh/config 配置如下

Host *
    User root
    IdentityAgent C:\Users\Administrator\OmniSSHCygwin.sock

并且秘钥生成的时候要用ssh-keygen -t ed25519 -P "" 这个类型用rsa好像不行。

from trzsz-ssh.

lonnywong avatar lonnywong commented on August 25, 2024

@huangming 是什么操作系统?

1、你可以在 ~/.ssh/config 中指定 IdentityAgent,指向 ssh-agent 的路径,如:

Host xxx
    IdentityAgent /path/to/ssh_agent

2、可以指定 SSH_AUTH_SOCK 环境变量,其优先级低于 IdentityAgent,如:

export SSH_AUTH_SOCK=/path/to/ssh_agent

from trzsz-ssh.

huangming avatar huangming commented on August 25, 2024

是windows,看起来是我这边配置的问题了,windows配置这个功能环境因素比较复杂多样,我再找找原因。谢谢作者贡献这么好的工具。

from trzsz-ssh.

lonnywong avatar lonnywong commented on August 25, 2024

Windows 用的是命名管道,默认的 IdentityAgent 是长这样子的:\\.\pipe\openssh-ssh-agent

from trzsz-ssh.

lonnywong avatar lonnywong commented on August 25, 2024

你可以搜一下 keepassxc named pipe,如 keepassxreboot/keepassxc#3190

如果默认 ssh 是支持的,按理说 tssh 也会支持。如果没有,可以把配置发出来,我抽空看看 tssh 还缺少什么功能。

from trzsz-ssh.

huangming avatar huangming commented on August 25, 2024

不对了,我好像搞错了一个问题。上面的方法是用git-bash的ssh命令,是可以用keepassxc来免密登录了,他可以获取到ssh-agent里面的秘钥(keepassxc写入的),但是当我用tssh的时候发现还要手动输入密码,没有使用agent的秘钥。报错如下:

[email protected]'s password:
new conn [xx.xxx.xx.xxx:22] failed: ssh: handshake failed: The handle is invalid.

我用ssh -vvv [email protected] 是可以观察到他访问了agent并使用了秘钥登录上服务器的。

from trzsz-ssh.

lonnywong avatar lonnywong commented on August 25, 2024

tssh --debug xxx 登录,看看输出什么?

from trzsz-ssh.

lonnywong avatar lonnywong commented on August 25, 2024

你用的是 Windows 版的 tssh.exe 吧?
试试 IdentityAgent 配置成 \\.\pipe\openssh-ssh-agent(或者不配置,默认就是这个)?

from trzsz-ssh.

huangming avatar huangming commented on August 25, 2024

tssh --debug xxx 登录,看看输出什么?

$ tssh --debug root@test-app
debug: C:\Users\Administrator.tssh.conf does not exist
debug: open config [C:\Users\Administrator.ssh\config] success
debug: decode config [C:\Users\Administrator.ssh\config] success
debug: dial ssh agent named pipe [C:\Users\Administrator\OmniSSHCygwin.sock] failed: Invalid pipe address 'C:\Users\Administrator\OmniSSHCygwin.sock'.
debug: will attempt key: C:\Users\Administrator.ssh\id_rsa ssh-rsa SHA256:*******************************************
debug: add auth method: public key authentication
debug: add auth method: keyboard interactive authentication
debug: add auth method: password authentication
debug: add UserKnownHostsFile: C:\Users\Administrator.ssh\known_hosts
debug: UserKnownHostsFile [C:\Users\Administrator.ssh\known_hosts2] does not exist
debug: GlobalKnownHostsFile [/etc/ssh/ssh_known_hosts] does not exist
debug: GlobalKnownHostsFile [/etc/ssh/ssh_known_hosts2] does not exist
debug: login to [test-app], addr: xx.xxx.xxx.xx:22
debug: open config [C:\Users\Administrator.ssh\password] success
debug: decode config [C:\Users\Administrator.ssh\password] success
debug: no extended config [encPassword] for [test-app]
debug: get extended config [Password] for [test-app] success
debug: trying the password configuration for test-app
debug: the password configuration for test-app is incorrect
[email protected]'s password:
new conn [xx.xxx.xxx.xx:22] failed: ssh: handshake failed: The handle is invalid.

from trzsz-ssh.

huangming avatar huangming commented on August 25, 2024

你用的是 Windows 版的 tssh.exe 吧? 试试 IdentityAgent 配置成 \\.\pipe\openssh-ssh-agent(或者不配置,默认就是这个)?

是的,windows版的 tssh.exe ,直接下载了丢到 C:\Windows\System32\tssh.exe 使用的

from trzsz-ssh.

lonnywong avatar lonnywong commented on August 25, 2024

debug: dial ssh agent named pipe [C:\Users\Administrator\OmniSSHCygwin.sock] failed: Invalid pipe address 'C:\Users\Administrator\OmniSSHCygwin.sock'.

C:\Users\Administrator\OmniSSHCygwin.sock 这是一个 Unix domain socket。我看 OmniSSHAgent 的 README 中写着支持 NamedPipe on Windows,但是他没有把 named pipe 具体是什么写出来,并把他让把 Windows 默认的 ssh-agent 服务停了,我猜他的 named pipe 就是 \\.\pipe\openssh-ssh-agent。你试试配置这个,或者不配置( 只要不显式配置,那默认值就是它 )。

from trzsz-ssh.

huangming avatar huangming commented on August 25, 2024

可以了,非常感谢!还是用回了win10自带的openssh,然后配置了你说的这个IdentityAgent不显示方式。

from trzsz-ssh.

lonnywong avatar lonnywong commented on August 25, 2024

可以了,非常感谢!还是用回了win10自带的openssh,然后配置了你说的这个IdentityAgent不显示方式。

你说的 openssh 是指 ssh-agent 服务,还是指 ssh 程序?

我没用过 keepassxc,我觉得 Windows 自带的 ssh-agent 服务就挺好用的。
开机后,在命令行中 ssh-add C:\Users\Administrator\.ssh\id_rsa,然后输入私钥的密码。不用什么特别的配置,tssh 就会直接使用那个私钥了。

from trzsz-ssh.

huangming avatar huangming commented on August 25, 2024

可以了,非常感谢!还是用回了win10自带的openssh,然后配置了你说的这个IdentityAgent不显示方式。

你说的 openssh 是指 ssh-agent 服务,还是指 ssh 程序?

我没用过 keepassxc,我觉得 Windows 自带的 ssh-agent 服务就挺好用的。 开机后,在命令行中 ssh-add C:\Users\Administrator\.ssh\id_rsa,然后输入私钥的密码。不用什么特别的配置,tssh 就会直接使用那个私钥了。

是的,ssh-agentssh都是在win10自带的可选应用openssh客户端里面。keepassxc的优势是启动了程序后会自动注入所有秘钥到agent,关闭的时候会自动删除agent的秘钥。本地不会有任何秘钥残留,除了keepassxc自身的本地数据库文件,这个是加密的比较安全。

from trzsz-ssh.

huangming avatar huangming commented on August 25, 2024

在windows下,自带的openssh的ssh命令对配置文件里面IdentityAgent值空置会有兼容性问题,导致ssh无法连接服务端,我现在是按照readme里面的操作把tssh配置成配置文件跟ssh配置文件分开了。

from trzsz-ssh.

lonnywong avatar lonnywong commented on August 25, 2024

在windows下,自带的openssh的ssh命令对配置文件里面IdentityAgent值空置会有兼容性问题,导致ssh无法连接服务端,我现在是按照readme里面的操作把tssh配置成配置文件跟ssh配置文件分开了。

为空时,应该直接删除,与空是等价的。

from trzsz-ssh.

huangming avatar huangming commented on August 25, 2024

在windows下,自带的openssh的ssh命令对配置文件里面IdentityAgent值空置会有兼容性问题,导致ssh无法连接服务端,我现在是按照readme里面的操作把tssh配置成配置文件跟ssh配置文件分开了。

为空时,应该直接删除,与空是等价的。

懂了,我原来一直误以为不配置的话不会去agent里面找秘钥,一定要配置一个。进入误区了。再次感谢。

from trzsz-ssh.

lonnywong avatar lonnywong commented on August 25, 2024

@huangming 我安装了 OmniSSHAgent 试用了一下,双击 OmniSSHAgent.exe 添加密钥之后,不需要在 ~/.ssh/config 和环境变量中做任何配置,tssh.exe 直接就可以用的了。--debug 运行会有下面这样的显示:

debug: new ssh agent client [\\.\pipe\openssh-ssh-agent] success

%_UCT480FI6NCLYQ6DUOT J

image

from trzsz-ssh.

huangming avatar huangming commented on August 25, 2024

@huangming 我安装了 OmniSSHAgent 试用了一下,双击 OmniSSHAgent.exe 添加密钥之后,不需要在 ~/.ssh/config 和环境变量中做任何配置,tssh.exe 直接就可以用的了。--debug 运行会有下面这样的显示:

debug: new ssh agent client [\\.\pipe\openssh-ssh-agent] success

%_UCT480FI6NCLYQ6DUOT J

image

是的,windows自带的openssh也是不用配置什么直接可以用的,是我一开始以为ssh客户端要配置那个sock地址才能跟agent交互,导致后面的一系列问题

from trzsz-ssh.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.