Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

Notices

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 01-12-2017, 12:14 AM
trondk trondk is offline
Registered User
 
Join Date: Jan 2017
Posts: 1
SSH2 login script does noe run

Hi
I use SSH2 on my devices and I`m trying to log in using login script I found on this site.
I must have done something wrong because when starting a session from Session Manager I am prompted for username and password in the session window. (not pop up boxes)
When I log out, the script suddenly runs and that gives me an error message since it it design for login.
Please advise
Se the script here:

#$language = "VBScript"
#$interface = "1.0"

Sub main
' turn on synchronous mode so we don't miss any data
crt.Screen.Synchronous = True

' Wait for a string that looks like "login: " or "Login: "
crt.Screen.WaitForString "ogin: "

' Send your username followed by a carriage return
crt.Screen.Send "My-username" & VbCr

' Wait for a string that looks like "password: " or "Password: "
crt.Screen.WaitForString "assword:"

' Send your password followed by a carriage return
crt.Screen.Send "My-password" & VbCr

' turn off synchronous mode to restore normal input processing
crt.Screen.Synchronous = False
End Sub
Reply With Quote
  #2  
Old 01-12-2017, 08:05 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,636
Hi trondk,

Quote:
I must have done something wrong because when starting a session from Session Manager I am prompted for username and password in the session window. (not pop up boxes)
Well no, having the prompts "in-line" (it's the Display logon prompts in terminal window configuration option in the Connection / Logon Actions category of Session Options) is necessary if you are going to handle them via the login script.

So to clarify, in the sessions that you wish to use the script, you have:
  • Cleared username from Username field in Connection / SSH2 category?

  • Cleared any saved passwords you might have by selecting Password in the Authentication grouping and then the Properties... button and unchecking Store password?

  • In Connection / Logon Actions category, enabled Logon script and configured the path to your login script?

  • In same category, enabled Display logon prompts in terminal window?

You don't get this far yet, but for future note:

Have you also verified that the "username/login" prompt from the remote is actually "Login:" or "login:"?

You may need to change that to "sername" to handle "Username:" or "username:".

Code:
' Wait for a string that looks like "username: " or "Username: "
crt.Screen.WaitForString "sername: "
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
Reply

Tags
login , script , ssh2

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 04:00 AM.