Linux清除SSH密钥登录记录

Linux清除SSH密钥登录记录

1.使用ssh登录服务器,提示是否链接,输入yes即可

    ~  ssh -p 22 username@ip                                    ✔ 
The authenticity of host 'ip(ip)' can't be established.
ED25519 key fingerprint is SHA256:JkgKYnoBYaeTpYawMHqoUL0adfasdfL0ccilMF+23icW6o.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? 

2.只要输入yes后,就代表密钥交互完成了。等到下一次链接的时候,就不会出现相关提示,只是提示你输入密码

    ~  ssh -p 22 usename@ip                          INT ✘  60s  
username@ip's password: 

3.密钥文件内容(未清除前)

    ~/.ssh  cat known_hosts                                             ✔ 
ip ssh-ed25519 asdfdC3NzaC1lZDI1Ndd5AAAAIOibiOXkNgLadWXKFn48AnmenmNoHUsM5onCrhsXz7qC

4.清除密钥交互信息

    ~  ssh-keygen -R ip                                     ✔ 
# Host ip found: line 9
/home/ttzo/.ssh/known_hosts updated.
Original contents retained as /home/ttzo/.ssh/known_hosts.old

5.清除后,known_hots文件中就没有了相关记录
6.清除后,known_hosts.old文件中会有备份的记录

ip ssh-ed25519 asdfdC3NzaC1lZDI1Ndd5AAAAIOibiOXkNgLadWXKFn48AnmenmNoHUsM5onCrhsXz7qC

注意:如果ssh端口是自定义的端口,则手工删除known_hosts中的相关记录即可

你可能感兴趣的:(centos,strream,ssh,linux)