VBScript
VBScript
Authenticate an SSH Tunnel with a Password
See more Socket/SSL/TLS Examples
Demonstrates Socket.SshAuthenticatePw, which authenticates an SSH tunnel session using a login and password. Call SshOpenTunnel first.
Background. Authenticate before opening forwarded channels. The password should come from a secure source and never be logged; public-key authentication is often preferred.
Chilkat VBScript Downloads
Dim fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
'Create a Unicode (utf-16) output text file.
Set outFile = fso.CreateTextFile("output.txt", True, True)
success = 0
set socket = CreateObject("Chilkat.Socket")
success = socket.SshOpenTunnel("ssh.example.com",22)
If (success = 0) Then
outFile.WriteLine(socket.LastErrorText)
WScript.Quit
End If
' Authenticate the SSH tunnel session with a login and password.
' The SSH password should come from a secure source rather than being hard-coded.
sshPassword = "mySshPassword"
success = socket.SshAuthenticatePw("sshUser",sshPassword)
If (success = 0) Then
outFile.WriteLine(socket.LastErrorText)
WScript.Quit
End If
outFile.WriteLine("SSH authentication succeeded.")
outFile.Close