SCP In Cold Fusion 6?

Posted on 2006-04-26
Last Modified: 2013-12-24
How to do it?
Question by:KCarter80
    LVL 36

    Accepted Solution

    afaik you can't natively

    I created a procedure to grab a daily xml file from my site via scp

     what I have done is:

    set up cygwin on the windows server and an ssh server
    created a ssh user and keyfile
    created an ant script to login copy the file via scp and then delete the remote file (s)

    <project name="CopyRemoteXML" default="GetFiles" basedir=".">
    <echo> ${ant.version}</echo>
          <target name="GetFiles">
    <scp trust="true" keyfile="C:\pathtoMyKeyfile\sshKey" toDir="\\server\xml\" passphrase="" file="*.xml">
    <sshexec host="" username="somename" trust="true" keyfile="C:\pathtoMyKeyfile\sshKey"
     command="rm /cygdrive/d/somedir/xml/*.xml"/>

    then I created a vbs script to run the ant script and write a log entry. I added the it to windows task scheduler to run every night

    Set ObjWS = WScript.CreateObject("WScript.Shell")
    ObjWS.Run ("C:\Eclipse\eclipse\plugins\org.apache.ant_1.6.5\bin\ant -buildfile \\server\scripts\build.xml")

    Const FOR_APPENDING = 8
    strFileName = "\\server\xml\logs\fetchlog.txt"
    strContent  = "Script Ran at:" & Now()  & vbNewLine

    Set objFS = CreateObject("Scripting.FileSystemObject")
    Set objTS = objFS.OpenTextFile(strFileName,FOR_APPENDING)
    objTS.Write strContent

    You could run this vbs script via cfexecute or cfschedule

    Author Comment

    Any body have any experience doing this on Linux (Redhat ES 3) boxes running CF?
    LVL 36

    Expert Comment

    that should be even easier(i think)  since scp is native to the OS

    something like this perhaps...
      name = "scp"
      arguments = "somefile.txt username@someplace:somedir/"
      timeout = "6000">


    Author Comment

    This is close to what I need.


    I'd like to use CF 6.1 (on a Red Hat server) to SCP a file to a remote host.

    CF runs as the nobody user. So I can't set up a key exchange since the nobody user doesn't have the usual directories to put the key in.

    Anyone have any thoughts on how to do this?
    LVL 36

    Expert Comment

    at minimum i'd say paq since my original solution works for windows folks and has value...(not that the original q was specific at all) for the points ...whatever

    Author Comment

    The windows solution does work in windows. Was never able to find a solution in Linux. Will accept the windows solution.

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    A web service ( is a software related technology that facilitates machine-to-machine interaction over a network. This article helps beginners in creating and consuming a web service using the ColdFusion Ma…
    When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now