Thursday, March 22, 2007

Clear Putty's Cache

For all those of you who have been trying to clear Putty’s cache of host fingerprints (Windows) for development or testing, here is the answer:

1. Open the registry (regedit)
2. Go to HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\SshHostKeys

There you should see Putty’s cache of host keys.
The ‘name’ column tells you which key is for which server.

For example, it will have the format of <algo>@<port>:<host> [rsa2@22:]

3. Delete the rows that you need and presto!

That’s all there is to it.


Tim said...

Good tip, thanks for the info. I found this useful as I had a script running plink from a service, as the SYSTEM user, which would fail because the server wasn't found in the cache.

I went into HKEY_CURRENT_USER as you describe and found the right key. I then went into HKEY_USERS/.../Software/SimonTatham etc. and pasted the data in. I had to guess as to which of the entries was the SYSTEM user, though.

Anonymous said...

Very usefull

Anonymous said...


George said...

This is perfect, Thanks or this been looking for hours on how to delete this damn sha key.

0x1337 said...

why use brute force?
putty -cleanup
and you're done

Anonymous said...

^ agree with this.
Simply open up a command prompt, go to the location of your putty.exe then execute

putty -cleanup

plink said...

This method is selective.
Putty -cleanup removes all

Anonymous said...

Thanks for the info. I also needed a selective method as described in the post. But it is nice to know about the -cleanup parameter as well.

Anonymous said...

thanks...its a really a nice help

Anonymous said...

Yes it's really helpful

Anonymous said...

Thanks a lot, it's really useful.

Anonymous said...

Thanks a lot. I can connect to my host after clearing the cache. saved my day....

Anonymous said...

Thanks, the selective delete came in handy.

chands said...


This post is very informative.
I have problem with my putty(on windows 8) in connecting to remote linux machine.It used to work before. Now suddenly it is throwing error "server unexpectedly closed network connection"
i tried clearing putty's cache and also checked in the registry.
But still same error.
I need help in resolving this issue. Your help is greatly appreciated.
thanks in advance.

Charles Knerr said...

4.5 years later... thanks.

To erase all sessions and cache, putty -cleanup

To remove specific keys, Use OP registry method.

1. Close all Putty windows and remove the keys from the registry.
2. Putty to the server, say yes to the key prompt.
3. Close putty
4. Connect again = no prompt.