通常,在linux中使用ssh的时候,如果出现这个错误,建议首先去查看log。
ubuntu的ssh的log记录在/var/log/auth.log
log错误会类似于如下:
Dec 22 09:43:31 x079-liongao sshd[14883]: error: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ Dec 22 09:43:31 x079-liongao sshd[14883]: error: @ WARNING: UNPROTECTED PRIVATE KEY FILE! @ Dec 22 09:43:31 x079-liongao sshd[14883]: error: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ Dec 22 09:43:31 x079-liongao sshd[14883]: error: Permissions 0777 for '/etc/ssh/ssh_host_dsa_key' are too open. Dec 22 09:43:31 x079-liongao sshd[14883]: error: It is recommended that your private key files are NOT accessible by others. Dec 22 09:43:31 x079-liongao sshd[14883]: error: This private key will be ignored. Dec 22 09:43:31 x079-liongao sshd[14883]: error: bad permissions: ignore key: /etc/ssh/ssh_host_dsa_key Dec 22 09:43:31 x079-liongao sshd[14883]: error: Could not load host key: /etc/ssh/ssh_host_dsa_key Dec 22 09:43:35 x079-liongao sudo: liongao : TTY=pts/3 ; PWD=/home/liongao ; USER=root ; COMMAND=/usr/bin/ssh localhost Dec 22 09:43:35 x079-liongao sshd[14892]: error: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ Dec 22 09:43:35 x079-liongao sshd[14892]: error: @ WARNING: UNPROTECTED PRIVATE KEY FILE! @ Dec 22 09:43:35 x079-liongao sshd[14892]: error: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ Dec 22 09:43:35 x079-liongao sshd[14892]: error: Permissions 0777 for '/etc/ssh/ssh_host_rsa_key' are too open. Dec 22 09:43:35 x079-liongao sshd[14892]: error: It is recommended that your private key files are NOT accessible by others. Dec 22 09:43:35 x079-liongao sshd[14892]: error: This private key will be ignored. Dec 22 09:43:35 x079-liongao sshd[14892]: error: bad permissions: ignore key: /etc/ssh/ssh_host_rsa_key Dec 22 09:43:35 x079-liongao sshd[14892]: error: Could not load host key: /etc/ssh/ssh_host_rsa_key Dec 22 09:43:35 x079-liongao sshd[14892]: error: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ Dec 22 09:43:35 x079-liongao sshd[14892]: error: @ WARNING: UNPROTECTED PRIVATE KEY FILE! @ Dec 22 09:43:35 x079-liongao sshd[14892]: error: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ Dec 22 09:43:35 x079-liongao sshd[14892]: error: Permissions 0777 for '/etc/ssh/ssh_host_dsa_key' are too open. Dec 22 09:43:35 x079-liongao sshd[14892]: error: It is recommended that your private key files are NOT accessible by others. Dec 22 09:43:35 x079-liongao sshd[14892]: error: This private key will be ignored. Dec 22 09:43:35 x079-liongao sshd[14892]: error: bad permissions: ignore key: /etc/ssh/ssh_host_dsa_key Dec 22 09:43:35 x079-liongao sshd[14892]: error: Could not load host key: /etc/ssh/ssh_host_dsa_key