如何禁用SSH密钥并使用密码login

我有一个棘手的情况。 首先,我通过键设置了一个ssh访问权限,我忘记了“keys”的密码,然后我无法连接。 我试图用另一台电脑login,我想我会login使用用户名和密码。 但这正是我所得到的 –

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:~$ 

我只是想知道如何禁用使用密钥和SSHlogin使用“用户名”和“密码”? 那我可以清理一切

我不认为你可以 – 在“可以继续的身份validation”部分中看不到密码或键盘交互。 您需要通过控制台进行连接并进行整理。 你的SSH守护进程不允许密码validation(即不提供你的机会)。

你必须有另一种方式login到这台机器(例如通过控制台)并设置

 PasswordAuthentication yes 

在你的sshd_config中

添加-o PasswordAuthentication

 ssh -v -p XXXX -o PasswordAuthentication XXX.XXX.XXX.XXX 

如果你的服务器允许,你可以使用密码而不是密钥。