Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to kick the tires of JSch and SSH connect to remote (Solaris) host from Java locally. I normally use PuTTy, which gives me a prompt about an unknown host every time I connect somewhere for the first time, then I say yes and it no longer does it because it stores known hosts in the Win7 registry. But JSch expects a known_hosts file and I am not sure how to make it.

Can anybody instruct how to export the known_hosts from the Win7 registry into the file format? I cannot go into the registry directly because I am not an admin on my laptop (company policy). I can call desktop support and they will do it but I would rather not go through the step. I figure if PuTTy can access the registry when I am using it then it should be able to also export data out of it.

Any idea?


share|improve this question
There is a python script which allegedly does what you need:… – JimmyB Nov 30 '12 at 8:59

The known_hosts file has a pretty standard format:

<hostname>[,<hostname2>...] ssh-rsa|ssh-dsa <ssh public key>

Ex. ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEA0d7Aoure0toNJ+YMYi61QP2ka8m5x5ZQlT7obP8CK3eropfqsMPPY6uiyIh9vpiFX2r1LHcbx139+vG6HOtVvuS8+IfMDtawm3WQvRuOopz3vVy5GtMwtaOgehsXoT930Ryev1bH5myPtWKlipITsOd2sX9k3tvjrmme4KCGGss=

You could try just building it yourself.

share|improve this answer
do i need to generate the public key? or is it already within the PuTTy registry data? – amphibient Oct 19 '12 at 16:23
@foampile If you have the private key, you can use PuTTyGen to create the public key from the private key. An alternative method is to connect to the target system from any linux-based system, and then check the ~/.ssh/known_hosts file on the system you connected from and copy the line matching the host out of that file. – Darth Android Oct 19 '12 at 17:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .