ssh: The authenticity of host 'hostname' can't be established

前端 未结 16 1099
时光取名叫无心
时光取名叫无心 2020-12-04 05:04

When i ssh to a machine, sometime i get this error warning and it prompts to say \"yes\" or \"no\". This cause some trouble when running from scripts that automatically ssh

相关标签:
16条回答
  • 2020-12-04 05:47

    To disable (or control disabling), add the following lines to the beginning of /etc/ssh/ssh_config...

    Host 192.168.0.*
       StrictHostKeyChecking=no
       UserKnownHostsFile=/dev/null
    

    Options:

    • The Host subnet can be * to allow unrestricted access to all IPs.
    • Edit /etc/ssh/ssh_config for global configuration or ~/.ssh/config for user-specific configuration.

    See http://linuxcommando.blogspot.com/2008/10/how-to-disable-ssh-host-key-checking.html

    Similar question on superuser.com - see https://superuser.com/a/628801/55163

    0 讨论(0)
  • 2020-12-04 05:47

    The best way to go about this is to use 'BatchMode' in addition to 'StrictHostKeyChecking'. This way, your script will accept a new hostname and write it to the known_hosts file, but won't require yes/no intervention.

    ssh -o BatchMode=yes -o StrictHostKeyChecking=no user@server.example.com "uptime"
    
    0 讨论(0)
  • 2020-12-04 05:47

    I solve the issue which gives below written error:
    Error:
    The authenticity of host 'XXX.XXX.XXX' can't be established.
    RSA key fingerprint is 09:6c:ef:cd:55:c4:4f:ss:5a:88:46:0a:a9:27:83:89.

    Solution:
    1. install any openSSH tool.
    2. run command ssh
    3. it will ask for do u add this host like. accept YES.
    4. This host will add in the known host list.
    5. Now you are able to connect with this host.

    This solution is working now......

    0 讨论(0)
  • 2020-12-04 05:49

    Make sure ~/.ssh/known_hosts is writable. That fixed it for me.

    0 讨论(0)
  • 2020-12-04 05:50

    Generally this problem occurs when you are modifying the keys very oftenly. Based on the server it might take some time to update the new key that you have generated and pasted in the server. So after generating the key and pasting in the server, wait for 3 to 4 hours and then try. The problem should be solved. It happened with me.

    0 讨论(0)
  • 2020-12-04 05:50

    Run this in host server it's premonition issue

    chmod -R 700 ~/.ssh
    
    0 讨论(0)
提交回复
热议问题