Home > Tech > com.jcraft.jsch.JSchException: UnknownHostKey

com.jcraft.jsch.JSchException: UnknownHostKey

Hello 😀

Great title don’t you think?

If you try a ssh connection with JSch, a Java implementation of  SSH2, you may recognize the title as an error message 😀

To solve that error you can add the host to $HOME/.ssh or add the follow lines to your code:


java.util.Properties config = new java.util.Properties(); config.put("StrictHostKeyChecking", "no");
session.setConfig(config);

Two easy options to solve your problem 😀

Advertisements
Categories: Tech Tags: , , ,
  1. July 30, 2009 at 08:06

    Thankyou for the solution. It worked 😀

  2. Mucci
    July 31, 2009 at 03:20

    Thanks man! This lines save my day.

  3. Manish
    June 23, 2011 at 06:40

    Thanks man… this really helped…

  4. vini
    October 12, 2011 at 19:50

    hey i’m new to this JSch class…..and i’m having some trouble with including jsch class to my programme……could you please tell me how to add the jsch jar file to eclipse…

    • joaopedrogranja
      October 12, 2011 at 20:38

      Hi there,

      If I remember correctly, you can follow this:

      • Right-click the name of the project, then -> properties
      • Click build paths
      • Click the libraries tag
      • Click add external jars
      • Browse to the location of the requisite jar
      • Click OK.
  5. Evgeny Isaev
    October 13, 2011 at 17:33

    Really, Thank you!

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: