我正在尝试通过 .sftp 连接到 sftp 服务器sftp USERNAME@SERVERNAME
。无论我做什么,我都会收到“权限被拒绝(公钥)”。谷歌搜索没有帮助,因为每个人都建议切换到基于密钥的身份验证,这对于无法控制服务器的人来说是一个有趣的想法。但也许服务器已经被切换了(没有人告诉我)。使用-v
我得到:
debug1: Host HOSTNAME is known and matches the RSA host key.
debug1: Found key in .../.ssh/known_hosts:5
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering public key: .../.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug1: Authentications that can continue: publickey
debug1: Trying private key: .../.ssh/id_dsa
debug1: No more authentication methods to try.
Permission denied (publickey).
Couldn't read packet: Connection reset by peer
这是否意味着服务器根本不接受密码?
答案1
可以继续的身份验证:publickey
“身份验证可以继续”消息的第一个实例仅列出公钥。因此,服务器被设置为不接受任何其他身份验证方法,例如密码。
如果服务器也接受密码,您会看到:
可以继续的身份验证:公钥、密码
您需要要求系统管理员将您的公钥添加到authorized_keys
该帐户的文件中,或者在 中为您重新启用密码身份验证sshd_config
。