f



PuTTY Storing Host Keys in Windows Registry

Hello,

I have a question regarding PuTTY, which is stemming from a problem I
am facing at the moment.

I am writing a Python program using the modules paramiko and pysftp.
These modules are looking for the Host Key in
/users/{username}/.ssh/known_hosts, yet PuTTY insists on storing the
key in the Windows Registry.

Is there a way to convince PuTTY to store the host keys in a location
where my Python modules can read them?

Any help you can provide would be greatly appreciated.
0
johncalvinhall
8/16/2016 7:53:36 AM
comp.security.ssh 4228 articles. 0 followers. terra1024 (490) is leader. Post Follow

2 Replies
408 Views

Similar Articles

[PageSpeed] 54

Hi,

While I am also not a friend of storing information in the Windows
Registry you actually can read the SSH keys easily (as Python comes with
"batteries included" all is already there):

https://docs.python.org/3.5/library/winreg.html

import winreg

key = winreg.OpenKey(winreg.HKEY_CURRENT_USER, r'Software\ \
      SimonTatham\PuTTY\SshHostKeys', 0, winreg.KEY_READ)
for i in range(winreg.QueryInfoKey(key)[1]):
    print(winreg.EnumValue(key, i))

HTH!

-Michael

Am 16.08.16 um 09:53 schrieb johncalvinhall@gmail.com:
> Hello,
> 
> I have a question regarding PuTTY, which is stemming from a problem I
> am facing at the moment.
> 
> I am writing a Python program using the modules paramiko and pysftp.
> These modules are looking for the Host Key in
> /users/{username}/.ssh/known_hosts, yet PuTTY insists on storing the
> key in the Windows Registry.
> 
> Is there a way to convince PuTTY to store the host keys in a location
> where my Python modules can read them?
> 
> Any help you can provide would be greatly appreciated.
> 

0
Michael
8/17/2016 8:19:12 AM
Thank you!

This is the only response I've received regardding this problem from
the wide range of sources.

I appreciate your help.
0
johncalvinhall
8/17/2016 7:53:10 PM
Reply: