OpenSSH publickey authetication“Server Refused our key” 错误

本文解决客户端使用PUTTY时出现的密钥格式不兼容问题。当使用ssh-keygen生成密钥或PUTTY自带工具生成的密钥无法通过验证时,提供了两种解决方案:一是通过puttygen.exe转换私钥格式;二是直接拷贝公钥文本到服务器端authorized_keys文件中。

客户端用的PUTTY,Key生成不管是用ssh-keygen还是用putty自带的都无法通过验证,报“Server Refused our key” 错误

如果确定服务器端配置没问题,那问题就很有可能是——Key文件格式不兼容……

解决方法:

1、用ssh-keygen生成private key文件后,把此文件用puttygen.exe导入,会自动转换格式

2、用puttygen.exe生成public key后,直接拷贝粘贴文本到服务器端authorized_keys里,不要直接拷贝文件

windows环境的ssh git错误:C:\Users\qtf4134\.ssh>ssh -vT git@cc-github.bmwgroup.net OpenSSH_for_Windows_9.5p1, LibreSSL 3.8.2 debug1: Connecting to cc-github.bmwgroup.net [160.48.167.45] port 22. debug1: Connection established. debug1: identity file C:\\Users\\qtf4134/.ssh/id_rsa type 0 debug1: identity file C:\\Users\\qtf4134/.ssh/id_rsa-cert type -1 debug1: identity file C:\\Users\\qtf4134/.ssh/id_ecdsa type -1 debug1: identity file C:\\Users\\qtf4134/.ssh/id_ecdsa-cert type -1 debug1: identity file C:\\Users\\qtf4134/.ssh/id_ecdsa_sk type -1 debug1: identity file C:\\Users\\qtf4134/.ssh/id_ecdsa_sk-cert type -1 debug1: identity file C:\\Users\\qtf4134/.ssh/id_ed25519 type 3 debug1: identity file C:\\Users\\qtf4134/.ssh/id_ed25519-cert type -1 debug1: identity file C:\\Users\\qtf4134/.ssh/id_ed25519_sk type -1 debug1: identity file C:\\Users\\qtf4134/.ssh/id_ed25519_sk-cert type -1 debug1: identity file C:\\Users\\qtf4134/.ssh/id_xmss type -1 debug1: identity file C:\\Users\\qtf4134/.ssh/id_xmss-cert type -1 debug1: identity file C:\\Users\\qtf4134/.ssh/id_dsa type -1 debug1: identity file C:\\Users\\qtf4134/.ssh/id_dsa-cert type -1 debug1: Local version string SSH-2.0-OpenSSH_for_Windows_9.5 debug1: Remote protocol version 2.0, remote software version babeld-ee5ada27 debug1: compat_banner: no match: babeld-ee5ada27 debug1: Authenticating to cc-github.bmwgroup.net:22 as 'git' debug1: load_hostkeys: fopen C:\\Users\\qtf4134/.ssh/known_hosts2: No such file or directory debug1: load_hostkeys: fopen __PROGRAMDATA__\\ssh/ssh_known_hosts: No such file or directory debug1: load_hostkeys: fopen __PROGRAMDATA__\\ssh/ssh_known_hosts2: No such file or directory debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: algorithm: curve25519-sha256 debug1: kex: host key algorithm: ecdsa-sha2-nistp256 debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none debug1: expecting SSH2_MSG_KEX_ECDH_REPLY debug1: SSH2_MSG_KEX_ECDH_REPLY received debug1: Server host key: ecdsa-sha2-nistp256 SHA256:xXvNoncZK8Ng3ZVI1Q2RjJZu6ff1EbecZxg8lk1HM4g debug1: load_hostkeys: fopen C:\\Users\\qtf4134/.ssh/known_hosts2: No such file or directory debug1: load_hostkeys: fopen __PROGRAMDATA__\\ssh/ssh_known_hosts: No such file or directory debug1: load_hostkeys: fopen __PROGRAMDATA__\\ssh/ssh_known_hosts2: No such file or directory debug1: Host 'cc-github.bmwgroup.net' is known and matches the ECDSA host key. debug1: Found key in C:\\Users\\qtf4134/.ssh/known_hosts:1 debug1: ssh_packet_send2_wrapped: resetting send seqnr 3 debug1: rekey out after 134217728 blocks debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: ssh_packet_read_poll2: resetting read seqnr 3 debug1: SSH2_MSG_NEWKEYS received debug1: rekey in after 134217728 blocks debug1: get_agent_identities: ssh_get_authentication_socket: No such file or directory debug1: Will attempt key: C:\\Users\\qtf4134/.ssh/id_rsa RSA SHA256:6Bho/d79N9XZvaQtMuAfesSmRksJGgbU79FQMfDez20 debug1: Will attempt key: C:\\Users\\qtf4134/.ssh/id_ecdsa debug1: Will attempt key: C:\\Users\\qtf4134/.ssh/id_ecdsa_sk debug1: Will attempt key: C:\\Users\\qtf4134/.ssh/id_ed25519 ED25519 SHA256:LWHizuL2Qp8++4pp9vYgR8IMqm9uOy8Fb0hY1OPNavE debug1: Will attempt key: C:\\Users\\qtf4134/.ssh/id_ed25519_sk debug1: Will attempt key: C:\\Users\\qtf4134/.ssh/id_xmss debug1: Will attempt key: C:\\Users\\qtf4134/.ssh/id_dsa debug1: SSH2_MSG_EXT_INFO received debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp256-cert-v01@openssh.com,sk-ssh-ed25519-cert-v01@openssh.com,sk-ecdsa-sha2-nistp256-cert-v01@openssh.com,rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,sk-ssh-ed25519@openssh.com,sk-ecdsa-sha2-nistp256@openssh.com,ssh-ed25519,ecdsa-sha2-nistp521,ecdsa-sha2-nistp384,ecdsa-sha2-nistp256,rsa-sha2-512,rsa-sha2-256,ssh-rsa> debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can continue: publickey debug1: Next authentication method: publickey debug1: Offering public key: C:\\Users\\qtf4134/.ssh/id_rsa RSA SHA256:6Bho/d79N9XZvaQtMuAfesSmRksJGgbU79FQMfDez20 debug1: Server accepts key: C:\\Users\\qtf4134/.ssh/id_rsa RSA SHA256:6Bho/d79N9XZvaQtMuAfesSmRksJGgbU79FQMfDez20 debug1: Trying private key: C:\\Users\\qtf4134/.ssh/id_ecdsa debug1: Trying private key: C:\\Users\\qtf4134/.ssh/id_ecdsa_sk debug1: Offering public key: C:\\Users\\qtf4134/.ssh/id_ed25519 ED25519 SHA256:LWHizuL2Qp8++4pp9vYgR8IMqm9uOy8Fb0hY1OPNavE debug1: Authentications that can continue: publickey debug1: Trying private key: C:\\Users\\qtf4134/.ssh/id_ed25519_sk debug1: Trying private key: C:\\Users\\qtf4134/.ssh/id_xmss debug1: Trying private key: C:\\Users\\qtf4134/.ssh/id_dsa debug1: No more authentication methods to try. git@cc-github.bmwgroup.net: Permission denied (publickey).
07-29
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值