SSH using ASP - WeOnlyDo Discussion board

SSH using ASP (wodSSH / wodSSH.NET)

by Sandeep, Thursday, September 14, 2006, 00:42 (6444 days ago)

I am able to execute commands on a unix machine which allows telnet.Below is the code I use.

set cmchk = Server.CreateObject( WeOnlyDo.wodSSHCom.1 )
cmchk.blocking = true
cmchk.login = login
cmchk.password = password
cmchk.hostname = 222
cmchk.LicenseKey = d-f-g-r
cmchk.port = 23
cmchk.connect
On Error Resume Next

Debug.Print(cmchk.waitfor( # ))
scm = (cmchk.Execute( comm & vblf, # ))
cmchk.Disconnect
response.write(scm)

The problem is that I am not able to do SSH to another unix machine. Below is the code I use.

set cmchk = Server.CreateObject( WeOnlyDo.wodSSHCom.1 )
cmchk.blocking = true
cmchk.login = login
cmchk.password = password
cmchk.hostname = 22.33.33.33
cmchk.LicenseKey = d-g-w-e
cmchk.port = 22
cmchk.protocol =SSHAuto
cmchk.connect

On Error Resume Next

Debug.Print(cmchk.waitfor( # ))
scm = (cmchk.Execute( ls & vblf))

cmchk.Disconnect
Response.Write( hello &scm)

Any help would be appreciated.


Thanks,
Sandeep

Re: SSH using ASP

by wodSupport, Thursday, September 14, 2006, 01:08 (6444 days ago) @ Sandeep

Sandeep,

from my previous experience, I would say problem is in Windows Firewall that doesn't allow users with IUSR_COMPUTER privileges to access outside world.

Can you lower your shields on the server by disabling Windows Firewall and try if it works?

Kreso

Re: SSH using ASP

by Sandeep, Thursday, September 14, 2006, 15:52 (6443 days ago) @ wodSupport

Thanks for the Reply,

I did try by allowing all traffic from the windows server to the linux server but still no Luck. As I mentioned earlier I am able to get to another unix server. I am also able to use Putty and login( BOth telnet and SSH) to the unix server from the same windows server. Any other suggestions please?

Thanks,
Sandeep

Re: SSH using ASP

by wodSupport, Thursday, September 14, 2006, 15:54 (6443 days ago) @ Sandeep

And if you try to connect to that UNIX server from within regular desktop application, does it work?

Kreso

Re: SSH using ASP

by Sandeep, Thursday, September 14, 2006, 16:00 (6443 days ago) @ wodSupport

Yes, I am able to SSH from my desktop using Putty.

Thanks,
Sandeep

Re: SSH using ASP

by wodSupport, Thursday, September 14, 2006, 16:07 (6443 days ago) @ Sandeep

What error did you say you get? Timeout or something else?

Kreso

Re: SSH using ASP

by sandeep, Thursday, September 14, 2006, 16:27 (6443 days ago) @ wodSupport

Yes Timeout

Re: SSH using ASP

by wodSupport, Thursday, September 14, 2006, 16:28 (6443 days ago) @ sandeep

Are you sure you disabled firewall? Disable it completely and try again.

Kreso

Re: SSH using ASP

by Sandeep, Thursday, September 14, 2006, 16:41 (6443 days ago) @ wodSupport

Well I just changed the code and found that I am able to connect. The error I receive now is

Last login: Thu Sep 14 04:26:04 2006 from nocmon.iw.net
Microsoft VBScript runtime error '800a01b6'

Object doesn't support this property or method: 'Print'

/scm/sshtest.asp, line 38

Code I use is

Debug.Print cmchk.waitfor( # )
scm = cmchk.Execute( ls & vblf)

Re: SSH using ASP

by wodSupport, Thursday, September 14, 2006, 16:46 (6443 days ago) @ Sandeep

Well, this is ASP error, not wodSSH anymore.

Perhaps you should try to use

Response.Write

instead? But please consult ASP help for that.

Regards,
Kreso

Re: SSH using ASP

by Sandeep, Thursday, September 14, 2006, 17:01 (6443 days ago) @ wodSupport

I almost agree with you but your manual says the syntax for
Wait for is

Debug.Print Ssh1.WaitFor( joe@debian )


I f I USE RESPONSE.WRITE I GET THE BELOW ERROR.

WeOnlyDo.wodSSHCom.1 error '800a754a'

You should set pattern to wait for.

/scm/sshtest.asp, line 39

Re: SSH using ASP

by wodSupport, Thursday, September 14, 2006, 17:09 (6443 days ago) @ Sandeep

Yes, pattern for Waitfor is as explained there. But language where we described is VB, not ASP. That's why you get the error.

As for new error - WaitFor needs more arguments, unless Prompt property was set - and is not in your case.

Kreso

Re: SSH using ASP

by Sandeep, Thursday, September 14, 2006, 17:21 (6443 days ago) @ wodSupport

I used prompt and response.write. This works. I receive the correct output. The only thing left is I receive few special charecters at the beginning of each line and the entire output is in one line any options to eliminate these.

Thanks for all the Help

Sandeep.

Re: SSH using ASP

by wodSupport, Thursday, September 14, 2006, 17:23 (6443 days ago) @ Sandeep

I think StripANSI could help. You're probably receiving ANSI sequences.

You can also try to change TerminalType property to, for example, 'tty' or 'dumb' - that sometimes help.

Regards,
kreso

Re: SSH using ASP

by Sandeep, Thursday, September 14, 2006, 17:35 (6443 days ago) @ wodSupport

StripANSI is sometimes getting rid of the first line of the output. tty and dumb did not help either but Thanks for all the Help.

Thanks,
Sandeep