This article talks about the error one gets while accessing the device through ssh and how to resolve the issue
Suppose one tries to ssh the device to one of the interface ip address of the SRX on which ssh is enabled. The ssh connection is not successful and the below error message could be seen in the log messages
root@frsar01fwl02> show log messages | match "host key" Sep 27 12:00:11 frsar01fwl02 sshd[12511]: error: Could not load host key: /etc/ssh/ssh_host_rsa_key Sep 27 12:00:11 frsar01fwl02 sshd[12511]: error: Could not load host key: /etc/ssh/ssh_host_dsa_key Sep 27 12:00:17 frsar01fwl02 sshd[12516]: error: Could not load host key: /etc/ssh/ssh_host_key Sep 27 12:00:17 frsar01fwl02 sshd[12516]: error: Could not load host key: /etc/ssh/ssh_host_rsa_key Sep 27 12:00:17 frsar01fwl02 sshd[12516]: error: Could not load host key: /etc/ssh/ssh_host_dsa_key Sep 27 12:00:17 frsar01fwl02 sshd[12516]: Disabling protocol version 1. Could not load host key
The reason is that when a proper closure of the session does not take place i…e The session is not logged out by the typing command exit and instead the window is directly close and thus it stores the key with which the user logged in .Thus when the user tries to loging again a different cryptograhic vlaue of the password which is entered is genretaed and it tries to match the stored key which reults in the device to not accept the ssh request.
Command to view the stored key
root@240-2> file list /cf/root/.ssh authorise_key authorise_key2
Thus when the above command shows the below set of values it means that it would not accept the ssh request.
Thus we need to clear the stored keys as mentioned below
root@240-2> file delete /cf/root/.ssh/authorise_key root@240-2> file delete /cf/root/.ssh/authorise_key2
Once this command is executed the ssh request is accepted.