I'm addicted to ssh related work, so I'll write it as a memo for myself. It is assumed that the server that was once managed will be rebuilt. This time, the root user is doing all the settings.
[Client side] ・ MacBook Air (Retina, 13-inch, 2020) ・ MacOS Catalina (v10.15.7)
[Server side] CentOS Linux release 8.2.2004 (Core)
From control panel> server> server rebuild in conoha. It is assumed that the same ssh key will be used.
Use the console on the conoha side to allow the server to allow the IP address of the network used by your PC to connect to. You can check the IP address of the network here. https://www.cman.jp/network/support/go_access.cgi
##conoha console side
## "xxx.xxx.xxx.xxx"Is the IP address of your PC's network
firewall-cmd --permanent --zone=public --add-rich-rule="rule family="ipv4" source address="xxx.xxx.xxx.xxx" port protocol="tcp" port="22" accept"
Use your key to access your VPS. For the IP address, use the VPS address instead of the IP address of your PC network that you used earlier.
##Input at the terminal on your PC side
##Enter the IP address of the VPS in the IP address field
ssh -i kagi.pem [email protected]
##The route to the key depends on where you store it
##If the key is placed on the desktop on mac, the image below
## ssh -i /Users/xxx(username)/Desktop/kagi.pem [email protected]
If you rebuild with the same IP address as the server you built last time, you should get a warning and cannot access it.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
...(Omission)....
Host key verification failed.
When connecting to the server with ssh, it seems that the connection destination information is saved locally, but in this case the server information is the last time even though it is connected to the same IP address destination. I am angry that it is dangerous to access because it is different from when connecting.
Clear the connection destination settings in the .ssh folder.
##Input at the terminal on your PC side
## .To ssh folder
cd
cd .ssh
##Delete settings Enter the IP address of the VPS in the IP address field
ssh-keygen -R xxx.xxx.xxx.xxx
I was able to erase the information about the last server I was connected to.
##Input at the terminal on your PC side
##Enter the IP address of the VPS in the IP address field
ssh -i kagi.pem [email protected]
You may get a warning again.
The authenticity of host 'xxx.xxx.xxx.xxx (xxx.xxx.xxx.xxx)' can't be established.
...(Omission)...
Are you sure you want to continue connecting (yes/no/[fingerprint])?
Enter yes
. Login is complete.
It is very important to take notes because there are few opportunities to experience building an environment. The links and information I used to write down in my memos were useful.
Sometimes I stumble in the same place as before ...
Ssh connection from Mac terminal to instance of Lightsail
Recommended Posts