|
#1
|
|||
|
|||
Suppress SSH password prompts when scripted login fails
Hi
When creating an SSH2 session using the crt.Session.ConnectInTab method with a user name/password combination that gets rejected by the target device, I am presented with a "Password authentication failed" popup and then the "enter password" prompt, all of which is raining pretty hard on my automation parade. I would really like to suppress all popups, log that connection failed and move on. My connection attempt looks roughly as follows (nothing fancy): Code:
On Error Resume Next Set objSessionTab = crt.Session.ConnectInTab("/SSH2 /ACCEPTHOSTKEYS /L " & userid & " /PASSWORD " & password & " " & TargetNameOrIP, True, False) If (Err.Number <> 0) Then 'error handling Err.Clear End If Any pointers/suggestion/help is appreciated. |
#2
|
|||
|
|||
Hi PRZ,
You will need to enable Display logon prompts in terminal window in the Connection / Logon Actions category of SecureCRT's Session Options in order to suppress the pop-ups. The documentation for ConnectInTab method (Help topic Scripting / Script Objects Reference / Session Object) includes an example that illustrates one way you might check the connection failure. It requires the second optional parameter be set to True. In that example, the tab is just closed, but you could use the same idea to log the failure. The "ConnectInTabToHost" example in our "script sticky" here includes a more robust way to handle possible connection failures.
__________________
Thanks, --Brenda VanDyke Software Technical Support support@vandyke.com (505) 332-5730 |
#3
|
|||
|
|||
The "Display logon prompts in terminal window" option was what I was questing for - thanks! I see from that example that I was doing things a little backwards, waiting for the connection to complete and then catching the error if it failed, which meant I didn't get to read the terminal window until after that was done one way or another.
|
![]() |
Tags |
connect , login , ssh |
Thread Tools | |
Display Modes | Rate This Thread |
|
|