![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| log session | mm00123 | Linux | 15 | 03-24-2008 03:27 AM |
| sqlplus session being able to see unix variables session within a script | 435 Gavea | Shell Programming and Scripting | 2 | 07-03-2006 11:11 AM |
| Inactive Session | lowtaiwah | UNIX for Dummies Questions & Answers | 12 | 06-22-2006 12:37 AM |
| Telnet Session | pathanjalireddy | Shell Programming and Scripting | 6 | 04-06-2005 11:41 AM |
| is it possible to ssh within an ssh session? | noamkrief | UNIX for Dummies Questions & Answers | 4 | 11-14-2003 05:16 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
scripting an ssh session?
I know the root login/password for a machines, and I want to automate some commands like this from each: Code:
ssh root@remoteHost1 "tail /var/log/messages" ssh root@remoteHost2 "tail /var/log/messages" ssh root@remoteHost3 "tail /var/log/messages" ssh root@remoteHost4 "tail /var/log/messages" ssh root@remoteHost5 "tail /var/log/messages" My only problem is that I cant guarantee that the keys and such exist every time, cause there is often re-imaging done without my knowledge... and I dont want to enter "yes" and my password 6 times each time I wanna run my script... so I need to setup something like passwordless ssh but using a script to set it up, and then another script to run my commands... or both in one script, doesn't matter to me... Is this doable? or is it possible to constantly check STDIN, and when it matches /password\:/ then I pipe it my password, and if it matches /\(yes\/no\)/ then I know to pipe it "yes"... but then how would I mimic the enter key, cause Im pretty sure "\n" is not enter, but just a new line any help here? |
|
||||
|
1. Get your public key into the image.
* OR * 2. Get the people who do the re-imaging to re-install your key when they re-image. * OR * 3. ssh to your own machine taking an input file but use the option to allocate a pseudo-terminal, then in that ssh shell do the ssh to the actual target. Basically to get the password entered you should have a terminal allocated. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|