工作當中遇到的ssh錯誤


[root@1bcc1d3f9666 externalscripts]# /usr/sbin/sshd
Could not load host key: /etc/ssh/ssh_host_rsa_key        解決參考:http://blog.csdn.net/hyholine/article/details/7362073
Could not load host key: /etc/ssh/ssh_host_ecdsa_key                   解決命令: ssh-keygen -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key(https://linux.cn/article-4226-1.html)
Could not load host key: /etc/ssh/ssh_host_ed25519_key               解決命令:cd /etc/ssh  && ssh-keygen -A
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

解決linux中ssh登錄Warning:Permanently added (RSA) to the list of known hosts

遠程登錄==>

[root@i-nbje0lea .ssh]# ssh 192.168.9.10
Warning: Permanently added '192.168.9.10' (RSA) to the list of known hosts.
Last login: Fri Sep 25 15:37:49 2015 from 192.168.9.11

Warning:Permanently added (RSA) to the list of known hosts錯誤

因:在執行ssh 時,沒在本機的~/.ssh下生成known_hosts文件。

解決方案:
# vi/etc/ssh/ssh_config         //注意是客戶端設置文件
最后有兩行是
        StrictHostKeyChecking no             #登錄時是否詢問
        UserKnownHostsFile /dev/null     #表示隱藏known_hosts文件

兩行解釋如下:

StrictHostKeyChecking

If this flag is set to “yes”, ssh(1) will never automatically add host keys to the
             ~/.ssh/known_hosts file, and refuses to connect to hosts whose host key has changed.The default is “ask”.

UserKnownHostsFile
             Specifies a file to use for the user host key database instead of ~/.ssh/known_hosts.
把這兩行注釋掉並保存文件
再次執行ssh 192.168.9.10
出現提示

[admin@i-nbje0lea .ssh]$ ssh 192.168.9.10
The authenticity of host '192.168.9.10 (192.168.9.10)' can't be established.
RSA key fingerprint is 50:e9:44:87:86:c3:0f:85:ab:41:5e:33:1e:5b:6a:c1.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.9.10' (RSA) to the list of known hosts.
Last login: Fri Sep 25 15:27:34 2015 from 192.168.9.11

輸入yes后,則可看到在/root/.ssh目錄下生成了known_hosts文件:


[root@host100.ssh]# ls
id_rsa  id_rsa.pub  known_hosts

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM