Ubuntu

如何禁用 ssh 密鑰並使用密碼登錄

  • May 18, 2012

我遇到了一個棘手的情況。首先,我通過密鑰設置了 ssh 訪問,但我忘記了“密鑰”的密碼,然後我無法連接。我嘗試使用另一台電腦登錄,我想我會使用使用者名和密碼登錄。但這就是我得到的-

mylaptap@mylaptop870:~$ ssh -v -p XXXX XXX.XXX.XXX.XX
OpenSSH_5.3p1 Debian-3ubuntu3, OpenSSL 0.9.8k 25 Mar 2009
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to XXX.XXX.XXX.XX [XXX.XXX.XXX.XX] port XXXX.
debug1: Connection established.
debug1: identity file /home/mylaptap/.ssh/identity type -1
debug1: identity file /home/mylaptap/.ssh/id_rsa type -1
debug1: identity file /home/mylaptap/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_4.3
debug1: match: OpenSSH_4.3 pat OpenSSH_4*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.3p1 Debian-3ubuntu3
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host '[XXX.XXX.XXX.XX]:XXXX' is known and matches the RSA host key.
debug1: Found key in /home/mylaptap/.ssh/known_hosts:1
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,gssapi-with-mic
debug1: Next authentication method: gssapi-with-mic
debug1: An invalid name was supplied
Cannot determine realm for numeric host address

debug1: An invalid name was supplied
Cannot determine realm for numeric host address

debug1: An invalid name was supplied


debug1: Next authentication method: publickey
debug1: Trying private key: /home/mylaptap/.ssh/identity
debug1: Trying private key: /home/mylaptap/.ssh/id_rsa
debug1: Trying private key: /home/mylaptap/.ssh/id_dsa
debug1: No more authentication methods to try.
Permission denied (publickey,gssapi-with-mic).
mylaptap@mylaptop870:~$

我只是想知道如何禁用使用密鑰並使用“使用者名”和“密碼”登錄 ssh?然後我可以清理所有東西……

我認為您不能 - 您在“可以繼續的身份驗證”部分中看不到密碼或鍵盤互動。您需要通過控制台連接並對其進行整理。您的 ssh 守護程序不允許密碼驗證(即不為您提供機會)。

您必須通過其他方式登錄到這台機器(例如通過控制台)並設置

PasswordAuthentication yes

在你的 sshd_config

引用自:https://serverfault.com/questions/390011