Skip to content
AJ Mercer edited this page Sep 25, 2013 · 2 revisions

to get ssh working as a tag within a web context, I dropped

https://github.com/cfmlprojects/cfssh/tree/master/src/cfssh/tag/cfssh/cfc

to

{railo site context}/library/tag

eg for Railo Express /railo/WEB-INF/railo/library/tag/

To list a directory:

<cfssh action="listdir"
    username="username" 
    password="password" 
    host="hostname"
    port="22" 
    timeout="30"
    name="qryDirectory"
    directory="/var/tmp/"
/>
<cfdump var="#qryDirectory#" label="qryDirectory" expand="true" />

To upload a file:

<cfssh action="putFile"
    username="username" 
    password="password" 
    host="hostname"
    port="22" 
    timeout="30"
    name="ssh"
    
    localFile="#ExpandPath('./test.txt')#"
    remoteDirectory="/var/tmp/"
    filename="test.txt"
/>
<cfdump var="#ssh#" label="putFile" expand="true" />

This returns -1

Get a File:

<cfssh action="getFile"
    username="username" 
    password="password" 
    host="hostname"
    port="22" 
    timeout="30"
    name="ssh"
    
    localFile="#ExpandPath('./test.txt')#"
    remoteDirectory="/var/tmp/"
    filename="test.txt"
/>
<cfdump var="#ssh#" label="putFile" expand="true" />

Delete / Remove a file:

<cfssh action="remove"
    username="username" 
    password="password" 
    host="hostname"
    port="22" 
    timeout="30"
    name="ssh"
    item="/var/tmp/test.txt"
/>

Doesn't look like delete/remove returns anything??

Take a look at jsch.cfc for other functions eg

function getFile(
	required username, 
	password="", 
	key="", 
	passphrase="", 
	required host, 
	numeric port=22, 
	numeric timeout=30, 
	fingerprint="", 
	required remoteFile, 
	required localFile, 
	remoteDirectory=""
)
Clone this wiki locally