ssh remote host identification has changed

前端 未结 29 1947
故里飘歌
故里飘歌 2020-12-02 03:02

I\'ve reinstalled my server and I am getting these messages:

[user@hostname ~]$ ssh root@pong
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@           


        
相关标签:
29条回答
  • 2020-12-02 03:43

    Use

    ssh-keygen -R [hostname]
    

    Example with an ip address/hostname would be:

    ssh-keygen -R 168.9.9.2
    

    This will update the offending of your host from the known_hosts. You can also provide the path of the known_hosts with -f flag.

    0 讨论(0)
  • 2020-12-02 03:43

    Just do:

    cd /home/user/.ssh/ -> here user will be your username, i.e. /home/jon/ for example.

    Then

    gedit known_hosts & and delete the contents inside it.

    Now ssh again, it should work.

    0 讨论(0)
  • 2020-12-02 03:44

    The other answers here are good and working, anyway, I solved the problem by deleting ~/.ssh/known_hosts. This certainly solves the problem, but it's probably not the best approach.

    0 讨论(0)
  • 2020-12-02 03:44

    This is because your remote computer settings have changed. Remove your current keys for that.

    vim /root/.ssh/known_hosts

    Delete the line of the IP you are connecting.

    0 讨论(0)
  • 2020-12-02 03:44

    Only client side problem(duplicate key for ip):

    Solve variants:

    For clear one ip(default port 22):

    ssh-keygen -f -R 7.7.7.7
    

    For one ip(non default port):

    ssh-keygen -f -R 7.7.7.7:333
    

    Fast clear all ips:

    cd ~; rm .ssh/known_hosts
    

    7.7.7.7 - ssh your server ip connect

    333 - non standart port

    0 讨论(0)
  • 2020-12-02 03:45

    When you reinstall the server its identity changes, and you'll start to get this message. Ssh has no way of knowing whether you've changed the server it connects to, or a server-in-the-middle has been added to your network to sniff on all your communications - so it brings this to your attention.

    Simply remove the key from known_hosts by deleting the relevant entry:

    sed '4d' -i /var/lib/sss/pubconf/known_hosts
    

    The 4d is on the account of Offending RSA ...known_hosts:4

    0 讨论(0)
提交回复
热议问题