CFSSH (Secure FTP) In Lucee
We have been migrating a lot of scheduled tasks from an old ColdFusion server to Lucee. A coworker recently asked me for help because they noticed that one particular task which used CFFTP was failing. Apparently Lucee doesn’t natively support the ‘secure’ attribute of CFFTP.
My co-worked had done some research and found CFSSH but was having some issues getting it to work.
There are a few old forum posts that mention this tag but they seem a bit outdated. Not sure if the tag or Lucee (Railo) changed but I thought I’d post what I did here for reference. Note I am doing this on Windows with a recent Lucee install. You may need to tweak paths if you are on Railo or a different OS.
- Download ZIP from Github: https://github.com/cfmlprojects/cfssh
- Unzip
- Copy the \cfssh-master\cfssh-master\src\cfssh\tag\cfssh to the following directory C:\inetpub\wwwroot\railo\WEB-INF\lucee\customtags
- Restart Lucee
Previous posts mentioned copying things to \WEB-INF\lucee\library\tag but when I did that Lucee threw an error and reading the error it seemed the only place it was looking for custom tags is in the /customtags folder.
Previous examples also referred to calling the tag via
:::coldfusion
<cfssh .... />
Which also threw an error. I found some old Railo posts that mentioned the correct way was to prefix the tag with CF_:
:::coldfusion
<cf_ssh .... />
Which worked!
:::coldfusion
<cf_ssh action="listdir"
username="username"
password="password"
host="hostname"
port="22"
timeout="30"
name="qryDirectory"
directory="/var/tmp/"
/>
Digging into the source I found the following methods:
- ListDir
- PutFile
- GetFile
- Delete
- Exists
- Remove
- RemoveDir