6

How can I disable security alerts like "The server's host key is not cached in registry, bla-bla-bla", "host identity is changed, there is man-in-the middle", etc

They are needless in cloud hosting environment, where a lot of new server instances appear. And also, it is quite normal if there eventually will be a new server on the same IP.

In linux ssh client I have done it with the following lines in my .bashrc:

alias ssh='ssh -o "StrictHostKeyChecking no" -o "UserKnownHostsFile=/dev/null" -o "CheckHostIP=no"'
alias scp='scp -o "StrictHostKeyChecking no" -o "UserKnownHostsFile=/dev/null" -o "CheckHostIP=no"'
But how to do it in putty?

10 Answers 10

4

There doesn't seem to be any hope:

No, there isn't. And there won't be. Even if you write it yourself and send us the patch, we won't accept it.

| improve this answer | |
  • Hm. Maybe a 3rd party launcher... – Anonymous Feb 12 '10 at 21:31
4

I use AutoHotkey to create a script that runs in the background and scans for any particular warning popups that I don't care about, closing them automatically.

#Persistent
    SetTimer, ClosePopups, 100  ; Check every 1/10 of a second
return

ClosePopups:
    ; Putty popup definition
    IfWinExist, PuTTY Security Alert
    {
        WinActivate PuTTY Security Alert
        Send !y ; Press Alt+Y
    }

    ; Here's another example of a popup definition, for reference
    IfWinExist, Cisco AnyConnect Secure Mobility Client
    {
        WinGetText, output, Cisco AnyConnect Secure Mobility Client
        if output contains Connecting to this server may result in a severe security compromise
        {
            WinActivate Cisco AnyConnect Secure Mobility Client
            Send {Tab}{Space}
        }
    }
return
| improve this answer | |
  • My fellow James. These 2 things have bothered me for a long time. Thanks. – SuperJames Apr 5 '18 at 17:48
2

I found a solution for this.

Whenever you log in through Putty to any machine for first time, you will get that security message. Click Yes and it will cache the server’s host key in your system. The alert will not be displayed if you log in as the same user next time.

So the trick is:

Check in Appdata\Local Folder

After the host key is cached then you will see below mentioned files (.DAT and .RND) in the following location:

C:\Users\your_User\Appdata\Local

GDIPFONTCACHEV1.DAT and PUTTY.RND

Now just copy and paste both files for every user with which you want to log in at the same location C:\Users\Another_User\Appdata\Local

This worked for me.

| improve this answer | |
1

After much searching, found the answer here:

echo y | ssh -pw yourpassword root@yourservername.com

http://www.governmentsecurity.org/forum/index.php?showtopic=29368

| improve this answer | |
  • That link is now unavailable, and there is no program named ssh in PuTTY, but there is a program plink which does fix the cache with those arguments and input, although for me it (in 0.64) it doesn't exit properly unless I add -m NUL. – dave_thompson_085 Jun 22 '16 at 1:10
1

The accepted host keys for a specific user are stored in the registry. Once the current user has accepted the key(s), they can then be made available to others by exporting the registry entries from the current user, modifying the path to the new user, and then importing them back in.

  1. Using REGEDIT, export:

    [HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\SshHostKeys]

  2. Open the .reg file that contains the export

  3. Change all instances of

    HKEY_CURRENT_USER

    to

    HKEY_USERS\S-x-x-xx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxx

where S-x-x-xx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxx is the SID of the user in question.

  1. Run the .reg file to import back into the registry for that user:

    [HKEY_USERS\S-x-x-xx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxx\Software\SimonTatham\PuTTY\SshHostKeys]

NOTE: Username/SID mappings can be found in:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList]

| improve this answer | |
0

There is no "voluntary" flag to ignore the ssh warning.

Here is what I did to get around this:

$wshell = New-Object -ComObject wscript.shell

foreach($thisHost in $hostList)
{  
    foreach($file in $list)
    {
        .... stuff
        Write-Host "Copying file: " $file.FullName
        .... stuff
        Start-Process $PuttyExe -ArgumentList ($args)
        $wshell.SendKeys("Y")
        $wshell.SendKeys("{ENTER}")
        Sleep 1 
    }
}
| improve this answer | |
0

It is as i solved using C#...

  IntPtr x = FindWindow("#32770", "PuTTY Security Alert");
  IntPtr child = FindWindowEx(x, IntPtr.Zero, "Button", null);
  const int BM_CLICK = 0x00F5;
  SendMessage(child, BM_CLICK, IntPtr.Zero, IntPtr.Zero);
| improve this answer | |
  • 3
    Can you explain (1) how to use this, and (2) how it works? Please do not respond in comments; edit your answer to make it clearer and more complete. – Scott May 17 '19 at 21:01
-1

You could try the following option:

putty settings

| improve this answer | |
-1

Based on one of the answers above, this has worked for me with ver 0.70:

echo y | plink -pw password -m NUL user@host

After this putty doesn't show a prompt: putty -ssh -pw password user@host

| improve this answer | |
-1

just use switch "-batch", e.g. plink -batch -ssh ...

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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