KpyM Telnet/SSH Server - Forum
Works with putty, but not with Chilkat SSH or other clients
meaculpa Works with putty, but not with Chilkat SSH or other clients
 
My company has been using FreeSSHd for a few months, but we've had reliability problems that are becoming a support headache (i.e., having to stop and restart the service periodically).

I've been looking for another Windows SSH server that I could affordably deploy to several dozen computers (without relying on Cygwin). After I ran across KpyM in a Google search, I downloaded and installed it. It worked fine with putty, but the unregistered version expects the user to press enter after a five-second delay - which wouldn't work in a production environment. To get past this, I registered a copy of KpyM and have been trying to make it work since then.

Our in-house applications need to fire off single commands to the server and get the results back immediately – not interactively like a putty session. I’ve tried using both Chilkat’s SSH control and an open source control called Tamir.SharpSSH. With each, the client blocks until the timeout expires and the command is never executed on the server.

I haven't seen this problem posted in the forum, so I'm hoping this is just a KpyM configuration setting I have wrong. Does KpyM support single-commands or does it only support terminal mode? What do the pipe_mode and dumb_client INI file options do? I would appreciate any suggestions you might offer.


Kroum Grigorov
 
>..single-commands or does it only support terminal mode
KTS currently support only terminal mode(interactive sessions), so any client relying on non interactive sessions will NOT work.

>pipe_mode
pipe mode is usefull if you want to script your telnet/ssh session. I guess it might be reasonable for you to set this to 1, since you need just the output of a single command and not to interact with the app from your session.

>dumb_client
this tells the server to not send the lower-right character as some old clients do not handle this correctly.

>the client blocks until the timeout expires and the command is never executed on the server.
Could you provide some more information, at what point does the client block? Could you post a sample "script" that you are running?

Kroum


Kroum Grigorov
 
You can find bellow a working vbs example that scripts Chillkat ssh activex to connect to KTS, execute the ping command and fetch the output.

I've made the following changes to the default KTS settings to run the sample
1) enter registration_key
2) set allow_disconnected_sessions =0
3) set pipe_mode =1

Kroum

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
set ssh = CreateObject("Chilkat.Ssh")

' Any string automatically begins a fully-functional 30-day trial.
success = ssh.UnlockComponent("30-day trial")
If (success <> 1) Then
MsgBox ssh.LastErrorText
WScript.Quit
End If

' Hostname may be an IP address or hostname:
hostname = "127.0.0.1"
port = 22

' Keep a session log, which is available via the SessionLog
' property:
ssh.KeepSessionLog = 1

success = ssh.Connect(hostname,port)
If (success <> 1) Then
MsgBox ssh.LastErrorText
WScript.Quit
End If

'MsgBox "connected"


' When reading, if no additional data arrives for more than
' 5 seconds, then abort:
ssh.IdleTimeoutMs = 30000

' SSH Server Authentication
' If there is no login/password required, you must still call
' AuthenticatePw and use any values for login/password.
success = ssh.AuthenticatePw("user","password")
If (success <> 1) Then
MsgBox ssh.LastErrorText
WScript.Quit
End If

'MsgBox "authenticated"
' Open a session channel.

channelNum = ssh.OpenSessionChannel()
If (channelNum < 0) Then
MsgBox ssh.LastErrorText
WScript.Quit
End If

' Request a pseudo-terminal
termType = "dumb"
widthInChars = 80
heightInChars = 25
pixWidth = 0
pixHeight = 0
success = ssh.SendReqPty(channelNum,termType,widthInChars,heightInChars,pixWidth,pixHeight)
If (success <> 1) Then
MsgBox ssh.LastErrorText
WScript.Quit
End If

' Start a shell on the channel:
success = ssh.SendReqShell(channelNum)
If (success <> 1) Then
MsgBox ssh.LastErrorText
WScript.Quit
End If

'MsgBox "before command"

' Read until we get the command prompt
success = ssh.ChannelReceiveUntilMatch(channelNum,"C:\","ansi",1)
If (success <> 1) Then
MsgBox ssh.LastErrorText
WScript.Quit
End If

'MsgBox
dummy = ssh.GetReceivedText(channelNum,"ansi")

cmd = "ping www.kpym.com" & vbCr & vbLf
success = ssh.ChannelSendString(channelNum,cmd,"ansi")
If (success <> 1) Then
MsgBox ssh.LastErrorText
WScript.Quit
End If

'MsgBox "after command"

' Read until we get the command prompt
success = ssh.ChannelReceiveUntilMatch(channelNum,"C:\","ansi",1)
If (success <> 1) Then
MsgBox ssh.LastErrorText
WScript.Quit
End If

MsgBox ssh.GetReceivedText(channelNum,"ansi")
WScript.Quit


Kex
 
>>the client blocks until the timeout expires and the command is never executed on the server.
>Could you provide some more information, at what point does the client block? Could you post a sample "script" that you are running?

I saw the same behavior when trying to automate scripts in our environment, too. What's happening is that the SSH server starts cmd.exe, and cmd.exe is just waiting for input. The command given to ssh is ignored completely.

Kroum, would you be willing to add a non-interactive mode if it was funded? :)


 

© 2007 - 2008 Kroum Grigorov
Powered by phpBB © 2001, 2005 phpBB Group