Connecting to VAX, connection closed trying to connect
I'm using WinSCP 5.5.2 Build 4130 trying to SSH into an OpenVMS V6.2 VAX system running Process Software SSH V2.4.A {SSH-2.0-ReflectionForSecureIT_6.1.4.0 build 3197 - Process Software SSH for OpenVMS}. Is it that OpenVMS is supported with other settings? I've been working on this for weeks and I give up.
If I use the GUI, setting timeout to 200 seconds and unchecking Optimize Connection Buffer Size, connection is made but tells me: server's host key not found in cache, gives me the key, and then asks me where to put a key to cache. Whether I say YES or NO, I get in without problems. But with the .NET client code (shown below), it dies after a minute at OPEN(SESSIONOPTIONS) saying the following message (I cut it in size because it's way too long a message). I did take the key shown in the GUI and used it with my .NET code but same issue, hangs at OPEN and then gives me same error message:
{WinSCP.SessionRemoteException: Connection has been unexpectedly closed. Server sent command exit status 1. ---> WinSCP.SessionRemoteException: Error skipping startup message. Your shell is probably incompatible with the application (BASH is recommended)." & vbCrLf & " --- End of inner exception stack trace ---" & vbCrLf & " at WinSCP.SessionLogReader.Read(LogReadFlags flags)"
Here is the code I'm using:
Dim SessionOptions As New SessionOptions ' SCP configuration options
Dim Session As Session = New Session ' Linux connection configuration options
Dim Timer As New TimeSpan(2, 0, 0) ' Session Timeout interval: 2 hr, 0 min, 0 sec
With SessionOptions ' Set up session options
.AddRawSettings("PingType", "2") ' Send execute dummy protocol commands
.AddRawSettings("SendBuf", "0") ' Optimize connect buf size, recommend 262144
.AddRawSettings("SshProt", "3") ' Preferred SSH version: SSH-2 only
.AddRawSettings("Shell", "bash") ' SCP protocol: "bash"
.GiveUpSecurityAndAcceptAnySshHostKey = True' Accept any SSH host key
.HostName = Hostname ' Hostname's IP address is in Buf(2)
.Password = Pwd ' Provide decrypted password
.PortNumber = 22 ' Assign SSH channel 22
.Protocol = WinSCP.Protocol.Scp ' Assign SCP protocol
.UserName = Str ' Provide username
End With ' SessionOptions
With Session ' Execute statements referring to Session object
.DisableVersionCheck = False ' Don't check loaded lib against DLL on disk
.DebugLogPath = Path & "Debug\" & Buf(1) & ".log"' Set session debug path
.ExecutablePath = Path1 & "WinSCP.exe" ' Set path to SCP program
.IniFilePath = Path1 & "WinSCP.ini" ' Set path to INI file
.SessionLogPath = Path & "Session\" & Buf(1) & ".log"' Set session transaction log path
.Timeout = Timer ' Set session timeout to two hours
.Open(SessionOptions) ' Call Linux through SCP
Cmd = "./update.sh" ' Command to execute
If VAX = "1" Then Cmd = "@Search_Queue LOOP"' If this is a VAX, change the command
Str = (.ExecuteCommand(Cmd).Output).Replace(Chr(10), Chr(13) & Chr(10))' Linux/VAX execute, TTY capture
OutFile.WriteLine(Str) ' Dump execution text returned to file
Console.WriteLine(Str) ' Dump execution text returned to screen
End With ' Session
Now here's the acknowledgment from OpenVMS saying I connected:
4-Aug-2014 13:23:12 SSH2 (accepted) from user "account" at [ip_address,11813] (PCname)
If I use the GUI, setting timeout to 200 seconds and unchecking Optimize Connection Buffer Size, connection is made but tells me: server's host key not found in cache, gives me the key, and then asks me where to put a key to cache. Whether I say YES or NO, I get in without problems. But with the .NET client code (shown below), it dies after a minute at OPEN(SESSIONOPTIONS) saying the following message (I cut it in size because it's way too long a message). I did take the key shown in the GUI and used it with my .NET code but same issue, hangs at OPEN and then gives me same error message:
{WinSCP.SessionRemoteException: Connection has been unexpectedly closed. Server sent command exit status 1. ---> WinSCP.SessionRemoteException: Error skipping startup message. Your shell is probably incompatible with the application (BASH is recommended)." & vbCrLf & " --- End of inner exception stack trace ---" & vbCrLf & " at WinSCP.SessionLogReader.Read(LogReadFlags flags)"
Here is the code I'm using:
Dim SessionOptions As New SessionOptions ' SCP configuration options
Dim Session As Session = New Session ' Linux connection configuration options
Dim Timer As New TimeSpan(2, 0, 0) ' Session Timeout interval: 2 hr, 0 min, 0 sec
With SessionOptions ' Set up session options
.AddRawSettings("PingType", "2") ' Send execute dummy protocol commands
.AddRawSettings("SendBuf", "0") ' Optimize connect buf size, recommend 262144
.AddRawSettings("SshProt", "3") ' Preferred SSH version: SSH-2 only
.AddRawSettings("Shell", "bash") ' SCP protocol: "bash"
.GiveUpSecurityAndAcceptAnySshHostKey = True' Accept any SSH host key
.HostName = Hostname ' Hostname's IP address is in Buf(2)
.Password = Pwd ' Provide decrypted password
.PortNumber = 22 ' Assign SSH channel 22
.Protocol = WinSCP.Protocol.Scp ' Assign SCP protocol
.UserName = Str ' Provide username
End With ' SessionOptions
With Session ' Execute statements referring to Session object
.DisableVersionCheck = False ' Don't check loaded lib against DLL on disk
.DebugLogPath = Path & "Debug\" & Buf(1) & ".log"' Set session debug path
.ExecutablePath = Path1 & "WinSCP.exe" ' Set path to SCP program
.IniFilePath = Path1 & "WinSCP.ini" ' Set path to INI file
.SessionLogPath = Path & "Session\" & Buf(1) & ".log"' Set session transaction log path
.Timeout = Timer ' Set session timeout to two hours
.Open(SessionOptions) ' Call Linux through SCP
Cmd = "./update.sh" ' Command to execute
If VAX = "1" Then Cmd = "@Search_Queue LOOP"' If this is a VAX, change the command
Str = (.ExecuteCommand(Cmd).Output).Replace(Chr(10), Chr(13) & Chr(10))' Linux/VAX execute, TTY capture
OutFile.WriteLine(Str) ' Dump execution text returned to file
Console.WriteLine(Str) ' Dump execution text returned to screen
End With ' Session
Now here's the acknowledgment from OpenVMS saying I connected:
4-Aug-2014 13:23:12 SSH2 (accepted) from user "account" at [ip_address,11813] (PCname)