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中的相关记录即可

GitHub 加速计划 / li / linux-dash
10.39 K
1.2 K
下载
A beautiful web dashboard for Linux
最近提交(Master分支:1 个月前 )
186a802e added ecosystem file for PM2 4 年前
5def40a3 Add host customization support for the NodeJS version 4 年前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐