If you are using XShell, MobaXterm, or similar tools and encounter connection issues, please refer to the relevant documentation instead of the solutions below.
Possible Causes:
-
SSH Fingerprint Change:
- If the system disk of the instance is reset or the image is changed, the SSH fingerprint will change. This will cause an error when connecting via SSH: “REMOTE HOST IDENTIFICATION HAS CHANGED.”
-
Incorrect Local SSH Config File Permissions:
- If the permissions of the local SSH config file are incorrect, you may encounter errors when SSH tries to write to the configuration (or other files).
-
VSCode/PyCharm Connection Issues:
- VSCode may fail to distinguish between different instances when connecting to the same host on different ports, leading to incorrect connections and failures.
Troubleshooting Steps:
Step 1: Check the First Two Causes
- For Windows Users: Open PowerShell by searching for it in the Start menu.
- For Mac Users: Open Terminal by searching for it in Spotlight.
If the connection is normal, you do not need to proceed to the next step (i.e., no need to enter a password). You can then proceed to Step 2 to troubleshoot VSCode/PyCharm issues.
Other possible error messages include:
- Delete the
known_hostsand `config files mentioned in the error messages (these are local files, and the paths may vary for each user). - If there is a permission error with the RSA key, Windows users should set the key file to read-only. For Linux/Mac users, run
chmod 600 <rsa_file>to correct the permissions.
Step 2: Troubleshooting VSCode and PyCharm Connection Issues
VSCode Connection Issues:- Common Cause: HOST conflicts. For example, if you rent two instances (A and B) in the same region with the same host name but different ports, VSCode may write identical HOST alias entries in the
ssh/configfile. When instance A is shut down and instance B is started, VSCode may incorrectly connect to instance A instead of B, resulting in a connection failure. - Solution:
- Quick Fix: Delete the
C:\Users\USER\.ssh\configfile. - Elegant Solution: Edit the
configfile and modify theHostfield (alias name) to differentiate between instances before reconnecting.
- Quick Fix: Delete the
- Cause: PyCharm’s complex encapsulation and lack of visible logs require troubleshooting based on the error messages provided.