You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Azure Ubuntu服务器SSH连接提示‘Permission denied (publickey)’的问题求助

Azure Ubuntu服务器SSH连接提示‘Permission denied (publickey)’的问题求助

大家好,我遇到了一个SSH连接的棘手问题,想请各位帮忙排查下:

我在Azure上部署了一台Ubuntu 24.04服务器,当初创建实例时生成的密钥能正常用来SSH登录。之后我新建了一个名为dbrogdon的用户,并且生成了同类型的Ed25519密钥。接着我把新密钥的公钥复制到了服务器上~dbrogdon/.ssh/authorized_keys文件中,还特意设置了对应的权限,服务器上该目录和文件的权限如下:

drwx------ 2 dbrogdon dbrogdon 4.0K Jul 24 17:21 .
drwxr-x--- 3 dbrogdon dbrogdon 4.0K Jul 24 17:22 ..
-rw------- 1 dbrogdon dbrogdon  104 Jul 24 17:20 authorized_keys

我本地Mac上的私钥权限也按要求设置好了:

-rw-------  1 dbrogdon  staff   419B Jul 24 10:51 dbrogdon-key.pem

但当我尝试从Mac通过SSH连接到服务器时,还是失败了,调试日志的关键内容如下:

debug1: Host 'xxxxxxx' is known and matches the ED25519 host key.
debug1: Found key in /Users/dbrogdon/.ssh/known_hosts:53
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: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: get_agent_identities: bound agent to hostkey
debug1: get_agent_identities: agent returned 1 keys
debug1: Will attempt key: /Users/dbrogdon/.ssh/dbrogdon-key.pem ED25519 SHA256:xxxxxx explicit agent
debug1: Will attempt key: /Users/dbrogdon/.ssh/id_rsa RSA SHA256:xxxxxx
debug1: Will attempt key: /Users/dbrogdon/.ssh/id_ecdsa 
debug1: Will attempt key: /Users/dbrogdon/.ssh/id_ecdsa_sk 
debug1: Will attempt key: /Users/dbrogdon/.ssh/id_ed25519 
debug1: Will attempt key: /Users/dbrogdon/.ssh/id_ed25519_sk 
debug1: Will attempt key: /Users/dbrogdon/.ssh/id_xmss 
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,sk-ssh-ed25519@openssh.com,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ecdsa-sha2-nistp256@openssh.com,webauthn-sk-ecdsa-sha2-nistp256@openssh.com>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering public key: /Users/dbrogdon/.ssh/dbrogdon-key.pem ED25519 SHA256:xxxxxx explicit agent
debug1: Authentications that can continue: publickey
debug1: Trying private key: /Users/dbrogdon/.ssh/id_rsa
debug1: Trying private key: /Users/dbrogdon/.ssh/id_ecdsa
debug1: Trying private key: /Users/dbrogdon/.ssh/id_ecdsa_sk
debug1: Trying private key: /Users/dbrogdon/.ssh/id_ed25519
debug1: Trying private key: /Users/dbrogdon/.ssh/id_ed25519_sk
debug1: Trying private key: /Users/dbrogdon/.ssh/id_xmss
debug1: No more authentication methods to try.
dbrogdon@xxxxxxx: Permission denied (publickey).

我反复检查了权限设置,看起来都是符合要求的,但就是连不上,有没有大佬能帮我找找问题出在哪里?

备注:内容来源于stack exchange,提问作者Darrell Brogdon

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.16 10:39:40