Redhat SUSE Rockey Linux regenerate ssh key config after virtual machine cloning

We have clone machine, but the ssh key is the same, so the ssh key needs to be regenerate

user@MacBook-Pro ~ % ssh user@10.10.10.10
The authenticity of host '10.10.10.10 (10.10.10.10)' can't be established.
ED25519 key fingerprint is SHA256:stcmC+guisLHcQVIfwn4m5obgMNp7i37CjS7QKdi/z4.
This host key is known by the following other names/addresses:
    ~/.ssh/known_hosts:158: 10.10.20.10
    ~/.ssh/known_hosts:175: 10.10.30.10
    ~/.ssh/known_hosts:176: 10.10.40.10
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '10.10.10.10' (ED25519) to the list of known hosts.
(user@10.10.10.10) Password: 
Last login: Wed Aug 17 09:56:38 2022 from 10.88.10.88
/usr/bin/manpath: can't set the locale; make sure $LC_* and $LANG are correct
user@dir01:~> 

Remove filename with "key"

dir01:~ # cd /etc/ssh
dir01:/etc/ssh # ls -l
total 608
-rw------- 1 root root 577834 May  6  2021 moduli
-rw-r--r-- 1 root root   2403 May  6  2021 ssh_config
-rw------- 1 root root   1381 Apr 12 14:40 ssh_host_dsa_key
-rw-r--r-- 1 root root    604 Apr 12 14:40 ssh_host_dsa_key.pub
-rw------- 1 root root    505 Apr 12 14:40 ssh_host_ecdsa_key
-rw-r--r-- 1 root root    176 Apr 12 14:40 ssh_host_ecdsa_key.pub
-rw------- 1 root root    411 Apr 12 14:40 ssh_host_ed25519_key
-rw-r--r-- 1 root root     96 Apr 12 14:40 ssh_host_ed25519_key.pub
-rw------- 1 root root   2602 Apr 12 14:40 ssh_host_rsa_key
-rw-r--r-- 1 root root    568 Apr 12 14:40 ssh_host_rsa_key.pub
-rw-r----- 1 root root   3746 Aug 17 10:17 sshd_config
dir01:/etc/ssh # rm -f *_key*

Restart Server

dir01:/etc/ssh # init 6
Connection to 10.10.10.10 closed by remote host.
Connection to 10.10.10.10 closed.

reconnect to server and the SHA256 is renew

user@MacBook-Pro ~ % ssh user@10.10.10.10
The authenticity of host '10.10.10.10 (10.10.10.10)' can't be established.
ED25519 key fingerprint is SHA256:jJH1viXDlYocHrzwNF3ixtDiJXGh994PGoE56x+9nlc.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '10.10.10.10' (ED25519) to the list of known hosts.
(user@10.10.10.10) Password: 
Last login: Wed Aug 17 15:15:01 2022 from 10.88.10.88
/usr/bin/manpath: can't set the locale; make sure $LC_* and $LANG are correct
user@dir01:~> exit

張貼留言

0 留言