SFTP to a server with an authentication banner

1,455 views
Skip to first unread message

Nicki

unread,
Jul 3, 2015, 4:27:17 AM7/3/15
to intersystems...@googlegroups.com
Hi

I am using %Net.SSH.Session to connect to an SFTP server which has a banner.

However I get the following error:
SSH Connect Error '-2146430963': SSH Error [8010100D]: Failed getting banner  

And I cannot find any help in the docs.
In winscp I get the "authentication banner" screen on which you can click continue, and utilize the site.
Has anyone worked past this?



Dmitry Maslennikov

unread,
Jul 6, 2015, 4:44:56 AM7/6/15
to intersystems...@googlegroups.com
Did you try an example Method Test from class %Net.SSH.SFTP ?
Can you show your code, and maybe some public server for example?
I installed freeSSHd for SFTP with some banner
WinSCP show me banner window, and then I can work well.

this my code, which works well, with my SFTP server.
set host="localhost"
set port=22
set username="test"
set password="test"
set dir="/"

Set = ##class(%Net.SSH.Session).%New()
Set sc = s.Connect(host,port)
Quit:$$$ISERR(sc) sc
Set sc = s.AuthenticateWithUsername(username,password)
Quit:$$$ISERR(sc) sc
Set sc = s.OpenSFTP(.t)
Quit:$$$ISERR(sc) sc
Set sc = t.Dir(dir,.files)
Quit:$$$ISERR(sc) sc

zwrite files


--
--
Caché, Ensemble, DeepSee

---
You received this message because you are subscribed to the Google Groups "Caché, Ensemble, DeepSee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to intersystems-publi...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Dmitry Maslennikov
Lead Programmer at LETOGRAF
Maintainer of NBStudio
Skype: DAiMor

Nicki

unread,
Jul 6, 2015, 5:25:34 AM7/6/15
to intersystems...@googlegroups.com
I cannot post the server details but here is my test code:

try {

url=""
un=""
pwd=""

sc=##class(%Net.SSH.Session).TestExecute(url,un,pwd)
throw:($$$ISERR(sc)) ##class(%Exception.General).%New("Unable to TestExecute to "_url_", "_$system.Status.GetOneStatusText(sc))
sc,!

sftp=##class(%Net.SSH.Session).%New()
"Connect to "_url,!
sc=sftp.Connect(url,22)
throw:($$$ISERR(sc)) ##class(%Exception.General).%New("Unable to connect to FTP server "_url_", "_$system.Status.GetOneStatusText(sc))

"Creating AuthenticateWithUsername "_un_" "_pwd,!
sc=sftp.AuthenticateWithUsername(un,pwd)
throw:($$$ISERR(sc)) ##class(%Exception.General).%New("Unable to authenticate on FTP server "_url_" with "_un_" : "_pwd_", "_$system.Status.GetOneStatusText(sc))

"OpenSFTP",!
sc=sftp.OpenSFTP(.myssh)
throw:($$$ISERR(sc)) ##class(%Exception.General).%New("Unable to authenticate on FTP server "_url_" with "_un_" : "_pwd_", "_$system.Status.GetOneStatusText(sc))

sc=myssh.Put("/ensemble/nicki/test.txt","test.txt")
throw:($$$ISERR(sc)) ##class(%Exception.General).%New("Unable to put file on FTP server, "_$system.Status.GetOneStatusText(sc))
"file put",!

sc=myssh.CloseSFTP()
throw:($$$ISERR(sc)) ##class(%Exception.General).%New("Unable to close SFTP connection, "_$system.Status.GetOneStatusText(sc))

sc=sftp.Disconnect()
throw:($$$ISERR(sc)) ##class(%Exception.General).%New("Unable to close SSH session, "_$system.Status.GetOneStatusText(sc))

}catch(tException) {
"exception caught in test ",!,tException.DisplayString(),!

Dmitry Maslennikov

unread,
Jul 6, 2015, 5:47:20 AM7/6/15
to intersystems...@googlegroups.com
This code works for me, so it looks like some differents in banner and sshd settings, could be a cause.
Maybe you can show settings for this SSH server ?
And which version of Cache are you using ?
Mine
Cache for Windows (x86-64) 2015.2 (Build 638U) Sun May 31 2015 19:11:37 EDT

--
--
Caché, Ensemble, DeepSee

---
You received this message because you are subscribed to the Google Groups "Caché, Ensemble, DeepSee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to intersystems-publi...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages