Replies: 2 comments
-
Beta Was this translation helpful? Give feedback.
0 replies
-
Thank you very much for your reply. Although the problem still exists, I will try to figure it out myself. Thank you
…------------------ 原始邮件 ------------------
发件人: "libssh2/libssh2" ***@***.***>;
发送时间: 2023年11月24日(星期五) 上午10:42
***@***.***>;
***@***.******@***.***>;
主题: Re: [libssh2/libssh2] 关于libssh2_userauth_publickey_fromfile在x86_64的debian系统上无法互信的问题 (Issue #1237)
我用你test测了,libssh2我使用的版本是libssh2-1.10.0,并没有复现你的问题,libssh2_userauth_publickey_fromfile() 不会报错。
我的复现步骤:
1、改动了你test里的hostname变量为”127.0.0.1“。
2、创建adb用户,然后把id_rsa.pub-a和id_rsa-a重命名为id_rsa.pub和id_rsa,并存放到/home/adb/.ssh/目录下
3、su adb,创建/home/adb/.ssh/authorized_keys文件,并把id_rsa.pub中内容拷贝到其中。
4、编译test.c文件: gcc -g -o ssh test.c -lssh2
5、执行二进制文件ssh,结果如下:
另外,我使用gdb跟踪了下,libssh2_userauth_publickey_fromfile() 函数执行成功:
一般来说,报错”error:Username/PublicKey combination invalid“ 是因为用户和公钥不匹配,即你想要登录账户下authorized_keys里保存的公钥,与你登录时使用的私钥不匹配。再详细的说,假设当前机器A上的test用户,想要使用密钥/home/adb/.ssh/id_rsa登录上机器B上的adb用户,需要将/home/adb/.ssh/id_rsa.pub里的内容拷贝到机器B的adb用户目录下的authorized_keys(即机器B的/home/adb/.ssh/authorized_keys)中,如果机器B的/home/adb/.ssh/authorized_keys中保存的公钥与主机A上的/home/adb/.ssh/id_rsa不配对的话,就会报这个错误,建议你再排查下。
虽然但是。。。还是建议用英文描述问题,这样能更好的与社区的maintainer交流。
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
1.两台机器:x86_64 debian
ssh -V
OpenSSH_9.2p1 Debian-2+deb12u1, OpenSSL 3.0.11 19 Sep 2023
md5sum /lib/x86_64-linux-gnu/libssh2.so.1
00642b17d391ee68025cf0a1f5bbebee /lib/x86_64-linux-gnu/libssh2.so.1
2.已经配置好了互信,两台机器的私钥密钥均生成完毕,并添加到.ssh/authorized_keys
3.测试代码,公钥私钥均放到附件zip包中。
4.执行测试代码,libssh2_userauth_publickey_fromfile提供了空密码,返回的错误码为-18,并获取到error:Username/PublicKey combination invalid
5.请问这是bug还是我的哪部分操作有问题
test.zip
Beta Was this translation helpful? Give feedback.
All reactions