1

The below is my ColdFusion code to execute Putty(pscp.exe) , a command line application.

<cfset local.args[local.i++] = "-load" />
    <cfset local.args[local.i++] = "default" />
    <cfset local.args[local.i++] = "-batch" />
    <cfset local.args[local.i++] = "-pw" />
    <cfset local.args[local.i++] = variables.connectionParams.password />
    <cfset local.args[local.i++] = arguments.localFile />
    <cfset local.args[local.i++] = variables.connectionParams.username & "@" & variables.connectionParams.server & ":" & arguments.remoteFile />

    <cfexecute name="#Application.config.getValue("external.puttyExe")#" arguments="#local.args#" variable="local.result" errorVariable="local.errorOut" timeout="1000" />

But executing this always ends up with the error message saying "The server's host key is not cached in the registry. You have no guarantee that the server is the computer you think it is. The server's rsa2 key fingerprint is: ssh-rsa 1024 c4:a2:e1:c9:73:57:15:5t:4d:d9:3d:5y:01:h6 Connection abandoned. Lost connection"

I am using FreeSSHd(installed on my machine) as the server to connect to.

Not able to find why this error message is coming always.

FeeSSHd server installed on my machine

enter image description here

user3742125
  • 617
  • 2
  • 9
  • 31
  • This is a by design security feature of SSH. If you connect to the server using Putty app for the first time you would get the same prompt. You will need to add the host key to registry to allow this to work - using Plink you can do something like this - https://stackoverflow.com/questions/13598996/putty-wont-cache-the-keys-to-access-a-server-when-run-script-in-hudson – haxtbh Nov 13 '17 at 13:17
  • so , you mean I need to install plink.exe and use that instead of pscp.exe(the one I am using right now)? – user3742125 Nov 13 '17 at 13:36
  • Plink is designed for command line connection similar to ssh in Linux. – haxtbh Nov 13 '17 at 13:56
  • be specific on the answer. I dont want a definition for Plink....My question is, do I need to install plink.exe and use that instead of pscp.exe(the one I am using right now)? – user3742125 Nov 13 '17 at 14:00
  • 3
    This is caused by security rights. When you use puTTY on the server, you are running under a specific user account. ColdFusion is probably running under a different user account or the service account. The host keys are stored by user in the registry. – Scott Jibben Nov 14 '17 at 15:45

0 Answers0