SSH Scripting/Automation, How To?
From: Stefan (stefan_at_dragolov.com)
Date: 03/08/04
- Next message: Kurt Jaeger: "Re: SSH Scripting/Automation, How To?"
- Previous message: Jason M. LaPenta: "Q: pub key login still asks for password??"
- Next in thread: Kurt Jaeger: "Re: SSH Scripting/Automation, How To?"
- Reply: Kurt Jaeger: "Re: SSH Scripting/Automation, How To?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: 8 Mar 2004 09:59:55 -0800
I need to automate a connection from a Win2k machine to a Sun machine
over SSH.
The script should automatically log in (using a hard coded password),
execute various commands on the server. Some of the commands may
prompt the user, however, the script should handle this and
automatically respond to the prompts. Also, the script should return
some sort of error code if a command executed on the server is not
successful.
I can do this using Tera Term Pro which has its own macro/scripting
language. It allows you to automate login, to "wait" for a certain
prompt to appear on the server and then automate the response, and
also sets and error environment variable for error login.
Howerver, I need to do this using an SSH client and Tera Term Pro's
ssh version does not work with its scripting language.
Any ideas of what I can use to do this????
Here is an example of a script written in Tera Term Pro scripting
language. I need something that is very similar to this:
; Sample macro for Tera Term
; Telnet login
; open Tera Term
; command line = 'TERATERM myhost.mydomain' (telnet)
connect 'myhost.mydomain.com'
; set username
UsernamePrompt = 'login:'
Username = 'myusername'
PasswordPrompt = 'Password:'
Password = 'mypassword'
; login
wait UsernamePrompt
sendln Username
wait PasswordPrompt
sendln Password
; OK, auto login complete.
; Set up environment
wait 'Enter your area [ora]'
sendln 'ora'
; Set up development stage
wait 'Enter your development stage [devel]'
sendln 'devel'
; Select development account
wait 'Please select a development user: (DEV01-DEV40)'
sendln 'DEV24'
sendln 'cat hello_kitty.txt'
sendln 'exit'
- Next message: Kurt Jaeger: "Re: SSH Scripting/Automation, How To?"
- Previous message: Jason M. LaPenta: "Q: pub key login still asks for password??"
- Next in thread: Kurt Jaeger: "Re: SSH Scripting/Automation, How To?"
- Reply: Kurt Jaeger: "Re: SSH Scripting/Automation, How To?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|