The authenticity of host 'localhost (127.0.0.1)' can't be established的处理方法

本文介绍了一种解决SSH连接localhost时出现的主机认证问题的方法。通过修改ssh_config文件中的StrictHostKeyChecking和UserKnownHostsFile配置项,可以绕过SSH首次连接的信任提示,实现无障碍本地连接。

      ssh localhost的时候遇到:

ubuntu@VM-0-15-ubuntu:~/taoge/hadoop_begin/hadoop-2.7.5$ ssh localhost
The authenticity of host 'localhost (127.0.0.1)' can't be established.

     怎么办?

ubuntu@VM-0-15-ubuntu:~/.ssh$ chmod 777 /etc/ssh/ssh_config

    然后在这个文件的最后两行加上:

    StrictHostKeyChecking no
    UserKnownHostsFile /dev/null

    如下:

ubuntu@VM-0-15-ubuntu:~$ tail /etc/ssh/ssh_config
#   PermitLocalCommand no
#   VisualHostKey no
#   ProxyCommand ssh -q -W %h:%p gateway.example.com
#   RekeyLimit 1G 1h
    SendEnv LANG LC_*
    HashKnownHosts yes
    GSSAPIAuthentication yes
    GSSAPIDelegateCredentials no
    StrictHostKeyChecking no
    UserKnownHostsFile /dev/null
ubuntu@VM-0-15-ubuntu:~$ 

    于是乎:

ubuntu@VM-0-15-ubuntu:~$ ssh localhost
Warning: Permanently added 'localhost' (ECDSA) to the list of known hosts.

    搞定。 后面的问题一路顺畅。





评论 15
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值