Add host keys for putty (plink) for the system user 

Joined:
04/09/2007
Posts:
773

December 12, 2007 21:53:19    Last update: December 12, 2007 21:53:19
The first time you access an SSH host, you'll get and store the host key. Putty stores the host key in the registry. If you run putty plink as a Windows service, the host key should be available to the Windows system user. Otherwise, plink won't connect to the remote server.

The solution is to obtain the host key from an interactive session then save it for use for the system user. Here are the steps:

1. Access the remote host interactively with putty or plink. Accept the host key.

2. Run regedit and export the key HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\SshHostKeys. You'll get something like this:
Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\SshHostKeys]
"rsa2@22:192.168.21.4"="0x23,0xce80259ad9bd9e1bc9088f35f3bf7cf2daefa31069e368e53ccd970818bd88d2076c398972e1687e5ddbfa767c4e6e37558d85341b951ac5590eecd0509de0075c2aace13cf8585fd4c7909599740391ebb7c570d4f70239d94d9aa92c62091a5267462b89979716da7aaf2ccb1a27fc06afea7b8ce03c906ef816bc4c4df00b"
"rsa2@22:192.168.21.1"="0x23,0xd47c4642379c89119ad2e93040f35d53e6b37ba4ddaa1f367bfcf4b5d13fedd727b0c22d772d16229208e6a0dce55f1b08a29b76223fd4135f56d965aab69030449f4a8c6e64b35437b58ab82f801b49cfd7db4c7028d7a4c2cf689c53ed47017801cfcb122e5b4a43cde70333c8506c190111fa8df2acb9c2c020c372e7a0bd"


3. Edit the exported registry file, change HKEY_CURRENT_USER to HKEY_USERS\.DEFAULT:
[HKEY_USERS\.DEFAULT\Software\SimonTatham\PuTTY\SshHostKeys]
"rsa2@22:192.168.21.4"="0x23,0xce80259ad9bd9e1bc9088f35f3bf7cf2daefa31069e368e53ccd970818bd88d2076c398972e1687e5ddbfa767c4e6e37558d85341b951ac5590eecd0509de0075c2aace13cf8585fd4c7909599740391ebb7c570d4f70239d94d9aa92c62091a5267462b89979716da7aaf2ccb1a27fc06afea7b8ce03c906ef816bc4c4df00b"
"rsa2@22:192.168.21.1"="0x23,0xd47c4642379c89119ad2e93040f35d53e6b37ba4ddaa1f367bfcf4b5d13fedd727b0c22d772d16229208e6a0dce55f1b08a29b76223fd4135f56d965aab69030449f4a8c6e64b35437b58ab82f801b49cfd7db4c7028d7a4c2cf689c53ed47017801cfcb122e5b4a43cde70333c8506c190111fa8df2acb9c2c020c372e7a0bd"


4. Import the file back into the registry.
Share |
| Comment  | Tags