origin
I have two Tencent Cloud accounts in my hand, and a cloud server is linked to each account. Before, I could log in through ssh on the Mac Terminal terminal. Today, I found that one of them reported the following error: First, let’s talk about the solution
:
See There is such a sentence in the error message (here everyone’s hostname is different, you need to pay attention):
Add correct host key in /Users/hostname/.ssh/known_hosts to get rid of this message.
Then open the local terminal: vi /Users/hostname/.ssh/known_hosts
to delete the key value corresponding to the external network ip.
Then log in to the corresponding ip through ssh again, and report an error:
Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
At this time, you need to modify a configuration on the corresponding server. The method is as follows:
1. One-click login through the terminal on the Tencent Cloud server
2. Vim /etc/ssh/sshd_config Modify the PasswordAuthentication yes in the sshd_config file
3. Execute: /bin /systemctl restart sshd.service
4. Reset the password
You should be able to log in with ssh here.
The reason behind the investigation is that I redid the system before and made a remote connection again. After entering yes, this machine will write the information of the remote machine to the /Users/hostname/.ssh/known_hosts file. Need to delete first, and then reset the password.