Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

Thanks

share|improve this question
    
There is a python script which allegedly does what you need: kobowi.co.uk/blog/2011/08/… –  Hanno Binder Nov 30 '12 at 8:59
add comment

1 Answer

The known_hosts file has a pretty standard format:

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

Ex.

example.com 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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.