SFTP with key AND password

164 views
Skip to first unread message

hofar...@houseoffusion.com

unread,
May 28, 2013, 5:39:20 PM5/28/13
to ColdFusion Technical Talk

Hi all, I have used the built-in SFTP support in the past with a
public key and separately with a username and password. I am now
running into a situation where a server I need to connect with uses a
username, key, AND password to authenticate. (ColdFusion 9)

Unfortunately, the key and password arguments for CFFTP are mutually
exclusive, so it will allow one or the other but not both at the same
time.

When connecting to said server with a utility such as WinSCP it
connects with the username and key and then gives a note about
"additional authentication required" and prompts for a password (or
uses the saved password from settings).

I've also been attempting to use the jsch.cfc wrapper for the Java
JSch class (which ColdFusion uses under the hood anyway) without much
success (can't get that to connect at all, just gives a "packet
corrupt" error on the .connect() method).

So, I am curious if anyone else has had any experience using JSch to
connect to a server using a key and a password, or alternatively, if
someone might have code they're willing to share to script WinSCP from
ColdFusion (basically to push a file up and then get a directory
listing to verify it's been uploaded successfully)?


-Justin Scott

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:355848

hofar...@houseoffusion.com

unread,
May 28, 2013, 6:22:52 PM5/28/13
to ColdFusion Technical Talk

On Tue, May 28, 2013 at 5:39 PM, Justin Scott <levi...@darktech.org>wrote:

> Unfortunately, the key and password arguments for CFFTP are mutually
> exclusive, so it will allow one or the other but not both at the same
> time.
>



Are you sure, this is from cf8 docs showing key and passphrase in one
call...

<!--- Open the secure connection. --->
<cfftp action = "open"
username = "myusername"
connection = "My_query"
key="C:\mykeys\myprivatekey"
passphrase = "zHx628Fg"
fingerprint = "12:34:56:78:AB:CD:EF:FE:DC:BA:87:65:43:21"
server = "ftp.tucows.com"
secure = "yes">


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:355849

hofar...@houseoffusion.com

unread,
May 28, 2013, 6:34:22 PM5/28/13
to ColdFusion Technical Talk

> Are you sure, this is from cf8 docs showing key and passphrase in one
> call...

Thanks, the "passphrase" argument goes with the private key (e.g. if
the private key file itself is protected with a password, this would
be the password to unlock the key file so CF can read and use it).
This is different from the "password" argument which would be sent to
the remote server.


-Justin

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:355850
Reply all
Reply to author
Forward
0 new messages