Classic ASP
Classic ASP
Start SSH Keyboard-Interactive Authentication
See more SSH Examples
Demonstrates the Chilkat Ssh.StartKeyboardAuth method, which begins keyboard-interactive authentication. The only argument is the login name. It returns XML describing the server's prompts and whether each response should be echoed. Answer the prompts with ContinueKeyboardAuth.
Background: Keyboard-interactive is the flexible, prompt-driven SSH method — the server sends one or more questions (a password, a one-time code, a security question) and the client answers each. It is how SSH supports two-factor and other challenge-response schemes. The returned XML tells you exactly what to ask the user and whether to mask their input.
Chilkat Classic ASP Downloads
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
success = 0
' Demonstrates the Ssh.StartKeyboardAuth method, which begins keyboard-interactive
' authentication. The only argument is the login name. It returns XML describing the server's
' prompts and whether each response should be echoed.
set ssh = Server.CreateObject("Chilkat.Ssh")
' Connect to the SSH server. Port 22 is the usual SSH port.
sshPort = 22
success = ssh.Connect("ssh.example.com",sshPort)
If (success = 0) Then
Response.Write "<pre>" & Server.HTMLEncode( ssh.LastErrorText) & "</pre>"
Response.End
End If
' Begin keyboard-interactive authentication. The returned XML describes the prompts.
infoRequestXml = ssh.StartKeyboardAuth("mySshLogin")
If (ssh.LastMethodSuccess = 0) Then
Response.Write "<pre>" & Server.HTMLEncode( ssh.LastErrorText) & "</pre>"
Response.End
End If
Response.Write "<pre>" & Server.HTMLEncode( infoRequestXml) & "</pre>"
' Answer the prompt(s) with ContinueKeyboardAuth.
ssh.Disconnect
%>
</body>
</html>