How to establish ssh key pair when “Host key verification failed”

后端 未结 11 1820
抹茶落季
抹茶落季 2021-01-30 10:17

I have set up ssh key pairs between my desktop and two servers, and from the servers to my desktop, but after reinstalling the OS on my desktop, I can\'t re-establish the key-pa

相关标签:
11条回答
  • 2021-01-30 10:56

    When you try to connect your remote server with ssh:

    $ ssh username@ip_address
    

    then the error raise, to solve it:

    $ ssh-keygen -f "/home/local_username/.ssh/known_hosts" -R "ip_address"
    
    0 讨论(0)
  • 2021-01-30 10:58

    Also sometimes there is situation when you are working on serial console, then checking above command in verbose mode -v will show you /dev/tty does not exists, while it does.

    In above case just remove /dev/tty and create a symlink of /dev/ttyS0 to /dev/tty.

    0 讨论(0)
  • 2021-01-30 10:58

    Its means your remote host key was changed (May be host password change),

    Your terminal suggested to execute this command as root user

    $ ssh-keygen -f "/root/.ssh/known_hosts" -R [www.website.net]:4231
    

    You have to remove that host name from hosts list on your pc/server. Copy that suggested command and execute as a root user.

    $ sudo su                                                            // Login as a root user
    
    $ ssh-keygen -f "/root/.ssh/known_hosts" -R [www.website.net]:4231   // Terminal suggested command execute here
    Host [www.website.net]:4231 found: line 16 type ECDSA
    /root/.ssh/known_hosts updated.
    Original contents retained as /root/.ssh/known_hosts.old
    
    $ exit                                                               // Exist from root user
    
    $ sudo ssh root@www.website.net -p 4231                              // Try again
    

    I Hope this works.

    0 讨论(0)
  • 2021-01-30 11:00

    Step1:$Bhargava.ssh#

    ssh-keygen -R 199.95.30.220

    step2:$Bhargava.ssh #

    ssh-copy-id hostname@199.95.30.220

              Enter the the password.........
    

    step3: Bhargava .ssh #

    ssh hostname@199.95.30.220

    Welcome to Ubuntu 14.04.3 LTS (GNU/Linux 3.13.0-68-generic x86_64) * Documentation: https://help.ubuntu.com/ Ubuntu 14.04.3 LTS server : 228839 ip : 199.95.30.220 hostname : qt.example.com System information as of Thu Mar 24 02:13:43 EDT 2016 System load: 0.67 Processes: 321 Usage of /home: 5.1% of 497.80GB Users logged in: 0 Memory usage: 53% IP address for eth0: 199.95.30.220 Swap usage: 16% IP address for docker0: 172.17.0.1 Graph this data and manage this system at: https://landscape.canonical.com/ Last login: Wed Mar 23 02:07:29 2016 from 103.200.41.50
    

    hostname@qt:~$

    0 讨论(0)
  • 2021-01-30 11:00

    Task Passwordless authentication for suer.

    Error : Host key verification failed.

    Source :10.13.1.11 Target : 10.13.1.35

    Temporary workaround :

    [user@server~]$ ssh user@10.13.1.35 The authenticity of host '10.13.1.35 (10.13.1.35)' can't be established. RSA key fingerprint is b8:ba:30:46:a9:ab:70:12:1a:f2:f1:61:69:73:0a:19. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '10.13.1.35' (RSA) to the list of known hosts.

    Try to authenticate user again...it will work.

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