SSH 密码正确但失败

SSH 密码正确但失败

我尝试从我的 PC 到服务器建立 ssh 连接。我的公钥已存储在服务器中。在连接过程中,系统要求我输入密码,因此我输入了创建公钥时使用的密码。因此,我应该能够访问服务器。但是,我的访问被拒绝,而且发生这种情况没有任何原因。我尝试在 ssh 期间打印日志消息,如下所示。

所以我的问题是你能指出为什么会发生这个错误吗?

    OpenSSH_7.6p1, LibreSSL 2.6.2
    debug1: Reading configuration data /Users/me/.ssh/config
    debug1: /Users/me/.ssh/config line 1: Applying options for mls
    debug1: Reading configuration data /etc/ssh/ssh_config
    debug1: /etc/ssh/ssh_config line 48: Applying options for *
    debug1: Connecting to hostname port XX.
    debug1: Connection established.
    debug1: key_load_public: No such file or directory
    debug1: identity file /Users/me/.ssh/me.ppk type -1
    debug1: key_load_public: No such file or directory
    debug1: identity file /Users/me/.ssh/me.ppk-cert type -1
    debug1: Local version string SSH-2.0-OpenSSH_7.6
    debug1: Remote protocol version 1.99, remote software version 3.1.0 SSH Secure Shell (non-commercial)
    debug1: no match: 3.1.0 SSH Secure Shell (non-commercial)
    debug1: Authenticating to hostname:22 as 'me'
    debug1: SSH2_MSG_KEXINIT sent
    debug1: SSH2_MSG_KEXINIT received
    debug1: kex: algorithm: diffie-hellman-group1-sha1
    debug1: kex: host key algorithm: ssh-dss
    debug1: kex: server->client cipher: 3des-cbc MAC: hmac-sha1 compression: none
    debug1: kex: client->server cipher: 3des-cbc MAC: hmac-sha1 compression: none
    debug1: sending SSH2_MSG_KEXDH_INIT
    debug1: expecting SSH2_MSG_KEXDH_REPLY
    debug1: Server host key: ssh-dss SHA256:ZJNANfkansaff....
    debug1: Host 'host ip' is known and matches the DSA host key.
    debug1: Found key in /Users/me/.ssh/known_hosts:2
    debug1: rekey after 134217728 blocks
    debug1: SSH2_MSG_NEWKEYS sent
    debug1: expecting SSH2_MSG_NEWKEYS
    debug1: SSH2_MSG_NEWKEYS received
    debug1: rekey after 134217728 blocks
    debug1: SSH2_MSG_SERVICE_ACCEPT received
    debug1: Authentications that can continue: publickey
    debug1: Next authentication method: publickey
    debug1: Trying private key: /Users/me/.ssh/me.ppk
    Enter passphrase for key '/Users/me/.ssh/me.ppk': 
    debug1: Authentications that can continue: publickey
    debug1: No more authentication methods to try.
    me@hostname: Permission denied (publickey).

我读到过一些文章说这可能是文件/目录权限的问题。因此,我将 /Users/me/.ssh 的权限设置为 700,将其中的文件的权限设置为 600。但是,我仍然遇到同样的问题。

我在 ssh 中执行了 -vvv。这里,我附上了它的摘录。

   debug1: Server host key: ssh-dss    SHA256:KxI27OKkpUaov7pdKGwaPtH...
   debug3: hostkeys_foreach: reading file "/Users/me/.ssh/known_hosts"
   debug3: record_hostkey: found key type DSA in file /Users/me/.ssh/known_hosts:1
   debug3: load_hostkeys: loaded 1 keys from 131.112.16.206
   debug1: Host '131.112.16.206' is known and matches the DSA host key.
   debug1: Found key in /Users/me/.ssh/known_hosts:1
   debug2: bits set: 527/1024
   debug3: send packet: type 21
   debug2: set_newkeys: mode 1
   debug1: rekey after 4294967296 blocks
   debug1: SSH2_MSG_NEWKEYS sent
   debug1: expecting SSH2_MSG_NEWKEYS
   debug3: receive packet: type 21
   debug1: SSH2_MSG_NEWKEYS received
   debug2: set_newkeys: mode 0
   debug1: rekey after 4294967296 blocks
   debug2: key: /Users/me/.ssh/me.ppk (0x0), explicit
   debug3: send packet: type 5
   debug3: receive packet: type 6
   debug2: service_accept: ssh-userauth
   debug1: SSH2_MSG_SERVICE_ACCEPT received
   debug3: send packet: type 50
   debug3: receive packet: type 2
   debug3: Received SSH2_MSG_IGNORE
   debug3: receive packet: type 51
   debug1: Authentications that can continue: publickey
   debug3: start over, passed a different list publickey
   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: Trying private key: me.ppk
   Enter passphrase for key '/Users/me.ssh/me.ppk': 
   debug3: sign_and_send_pubkey: DSA    SHA256:G0FdRIXLPYrvaqtfpw5...
   debug3: send packet: type 50
   debug2: we sent a publickey packet, wait for reply
   debug3: receive packet: type 2
   debug3: Received SSH2_MSG_IGNORE
   debug3: receive packet: type 51
   debug1: Authentications that can continue: publickey
   debug2: we did not send a packet, disable method
   debug1: No more authentication methods to try.
   [email protected]: Permission denied (publickey).

我不太熟悉调试消息,但我想知道“服务器主机密钥:ssh-dss SHA256:KxI27OKkpUaov7pdKGwaP...”和“sign_and_send_pubkey:DSA SHA256:G0FdRIXL...”是否应该相同?

虽然我的私钥的扩展名是.ppk,但我已经通过Putty Key生成器将其导出为openSSH密钥。

谢谢。

相关内容