title: JSchException: UnknownHostKey
body: <p>I'm trying to use Jsch to establish an SSH connection in Java. 
  I have set "StrictHostKeyChecking" to yes. I understand that the hostkey of the server has to be obtained before hand and store in the hostkey file 
  before the first attempt to connect to the server. How can I get the HostKey of the server. My code produces the following exception:</p>
  
  <p>com.jcraft.jsch.JSchException: UnknownHostKey: ASY-PC 
  RSA key fingerprint is 22:fb:ee:fe:18:cd:aa:9a:9c:78:89:9f:b4:78:75:b4</p>
  
  <p>How can I make connection with StrictHostKeyChecking  Yes.
  Here is my code.</p>
  
  <pre><code>package sshexample;
  
  import com.jcraft.jsch.*;
  import java.io.*;
  
  public class SSHexample 
  {
  public static void main(String[] args) 
  {
      String user = "user";
      String password = "password";
      String host = "192.168.100.103";
      int port=22;
      try
      {
          JSch jsch = new JSch();
          Session session = jsch.getSession(user, host, port);
          session.setPassword(password);
          session.setConfig("StrictHostKeyChecking", "yes");
          System.out.println("Establishing Connection...");
          session.connect();
          System.out.println("Connection established.");
          System.out.println("Crating SFTP Channel.");
          ChannelSftp sftpChannel = (ChannelSftp) session.openChannel("sftp");
          sftpChannel.connect();
  }catch(Exception e) {
  e.printStackTrace();
  }
  }
  </code></pre>