Remote SSH connection without reinstalling Ubuntu Server

Source: Internet
Author: User
Tags ssh access

After the dailybuild server buildserver_01 crashes, back up the data after trying to recover it. Install OpenSSH-server on the server and then perform local remote access. The result shows that none of them can be connected.

The error is as follows:
1. Connect to the server through SSH...
Result prompt:

 Connection to host was closed

2. Remote Desktop view SSH connection Server

Error: Host key verification failed Please select another viewer and try again

These two methods are the two main methods that I usually connect to the server for operations. Remote Desktop view is used to operate through a character-like interface. In SSH mode, connect server is used to view the file directory, but it suddenly fails.
Question 1Is my network not configured properly? Is there a problem with the Ubuntu network configuration for reinstallation?
Ping command can be used to ping each other, And SMB can also be used for access. That's strange. Where is the problem. Accessing other servers locally is normal, and network problems can be basically ruled out.
Question 2Is there a problem with SSH installation? Then, uninstall the SSH OpenSSH-server on the server and then install it. You Cannot uninstall or restart the server again. In the past, SSH was installed like this. Installation is fine.

Review the error message about two failed connections.

The two connection methods cannot work in Multi-event SSH connection mode. Error: host key Verification Failed please select another viewer and try again are also prompted. I accidentally connected to Ubuntu in another Windows environment, and the result was OK. in windows, I accessed it with sshsecureshellclient. Is it my own Ubuntu access? Remember the SSH key of the old server system ?, Start from here.
Delete my local/root/. Ssh/known_hosts

Connect again, and the familiar interface appears

Okay, the connection is correct because I saved the Public Key locally.


Cause of SSH access failure: Ubuntu has been reinstalled on a server, and the system uses the same IP address and Mac. After logon, the SSH information will be recorded locally ~ In the/. Ssh/known_hsots file, a conflict warning occurs when the system is switched and accessed by SSH. You need to manually delete and modify the content in known_hsots.

There are two solutions:
1. manually delete and modify the content in known_hsots;
2. modify the configuration file "/root/. Ssh/config" and add the two lines to restart the server.

   StrictHostKeyChecking no   UserKnownHostsFile /dev/null

Advantages and disadvantages:
1. You need to manually delete the file content each time. Some automated scripts cannot run (failed during SSH Login), but the security is high;
2. During SSH Login, the access to known_hsots will be ignored, but the security is low;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.