SSH公钥认证在Ubuntu失败但在macOS成功的问题求助
SSH公钥认证在Ubuntu失败但在macOS成功的问题求助
各位好,我碰到了一个奇怪的SSH公钥认证问题,想请大家帮忙分析下:
我有两台机器,一台是macOS,一台是新配置的Ubuntu。在macOS上我可以正常用自己的公私钥通过SSH连接到目标服务器,但把同一组公私钥复制到Ubuntu上后,连接却失败了。另外要说明的是,macOS使用的是SSH v1,Ubuntu使用的是SSH v2。
1. macOS环境情况
.ssh目录下的文件:
/home/richardm/.ssh/id_rsa/home/richardm/.ssh/id_rsa.pub/home/richardm/.ssh/config/home/richardm/.ssh/known_hosts
配置文件(config)内容:
Host * AddKeysToAgent yes UseKeychain yes IdentityFile ~/.ssh/id_rsa ServerAliveInterval 240 User = richard ForwardAgent yes StrictHostKeyChecking=no IdentitiesOnly yes
SSH连接调试输出(执行命令:ssh -A -J richard@XX.XXX.XXX.XXX dev-myco-node01 -vvv):
debug3: preferred publickey,keyboard-interactive,password debug3: authmethod_lookup publickey debug3: remaining preferred: keyboard-interactive,password debug3: authmethod_is_enabled publickey debug1: Next authentication method: publickey debug1: Offering public key: /Users/richardm/.ssh/id_rsa RSA SHA256:CKEVmfXXXXXXXXXXXXXXXXXXXXXXXXXXXFrkI explicit agent debug3: send packet: type 50 debug2: we sent a publickey packet, wait for reply debug3: receive packet: type 60 debug1: Server accepts key: /Users/richardm/.ssh/id_rsa RSA SHA256:CKEVmfXXXXXXXXXXXXXXXXXXXXXXXXXXXFrkI explicit agent debug3: sign_and_send_pubkey: RSA SHA256:CKEVmfXXXXXXXXXXXXXXXXXXXXXXXXXXXFrkI debug3: sign_and_send_pubkey: signing using rsa-sha2-512 SHA256:CKEVmfXXXXXXXXXXXXXXXXXXXXXXXXXXXFrkI debug3: send packet: type 50 debug3: receive packet: type 52 debug1: Authentication succeeded (publickey).
2. Ubuntu环境情况
.ssh目录下的文件:
/home/richardm/.ssh/id_rsa/home/richardm/.ssh/id_rsa.pub/home/richardm/.ssh/config/home/richardm/.ssh/known_hosts
配置文件(config)内容:
Host * AddKeysToAgent yes # UseKeychain yes IdentityFile ~/.ssh/id_rsa ServerAliveInterval 240 User = richard ForwardAgent yes StrictHostKeyChecking=no IdentitiesOnly yes
SSH连接调试输出(执行命令:ssh -A -J richard@XX.XXX.XXX.XXX richard@dev-myco-node01 -vvv):
debug3: preferred publickey debug3: authmethod_lookup publickey debug3: remaining preferred: debug3: authmethod_is_enabled publickey debug1: Next authentication method: publickey debug1: Offering public key: /home/richardm/.ssh/id_rsa RSA SHA256:CKEVmfXXXXXXXXXXXXXXXXXXXXXXXXXXXFrkI explicit agent debug3: send packet: type 50 debug2: we sent a publickey packet, wait for reply debug3: receive packet: type 60 debug1: Server accepts key: /home/richardm/.ssh/id_rsa RSA SHA256:CKEVmfXXXXXXXXXXXXXXXXXXXXXXXXXXXFrkI explicit agent debug3: sign_and_send_pubkey: using publickey with RSA SHA256:CKEVmfXXXXXXXXXXXXXXXXXXXXXXXXXXXFrkI debug3: sign_and_send_pubkey: signing using rsa-sha2-512 SHA256:CKEVmfXXXXXXXXXXXXXXXXXXXXXXXXXXXFrkI sign_and_send_pubkey: signing failed for RSA "/home/richardm/.ssh/id_rsa" from agent: agent refused operation debug2: we did not send a packet, disable method debug1: No more authentication methods to try. richard@XX.XXX.XXX.XXX: Permission denied (publickey). kex_exchange_identification: Connection closed by remote
从输出里能看到,Ubuntu这边服务器已经接受了公钥,但签名环节提示agent refused operation,最终导致权限被拒。有没有朋友遇到过类似问题?麻烦帮忙指点下可能的原因和解决办法,谢谢!
备注:内容来源于stack exchange,提问作者Richard
相关产品推荐
相关产品推荐

