The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



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
ssh-keygen questions (not working) tekline UNIX for Advanced & Expert Users 10 09-01-2008 09:17 PM
Passing the values to the secondary script when it invoked by primary script venu_eie Shell Programming and Scripting 1 07-03-2008 06:16 AM
create a shell script that calls another script and and an awk script magikminox Shell Programming and Scripting 0 06-26-2008 02:50 AM
Shell Script: want to insert values in database when update script runs ring Shell Programming and Scripting 1 10-25-2007 03:06 AM
ssh-keygen trust problem PaulC SuSE 4 04-21-2005 09:17 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-08-2008
jagnikam jagnikam is offline
Registered User
  
 

Join Date: Jan 2008
Posts: 56
SSH-Keygen script

Hello friends,
I wanna to make new script which work as i defined below

(1) it connect (using ssh) to remote server
(2) remote server having passphrase key with password
(3) Generate new passphrase on local machine with random 8 character password.
(4) It will atomatically uploaded to the remote server & mail send to specified users with new password.

I need some help from you guys to complete this script. now i am stucked at the point of providing password while generating script. can anybody tell me how can i provide password to the script ........................???????????
  #2 (permalink)  
Old 10-08-2008
danmero danmero is offline Forum Advisor  
  
 

Join Date: Nov 2007
Location: 45.48-73.63
Posts: 1,369
man expect
  #3 (permalink)  
Old 10-09-2008
ashishparimoo ashishparimoo is offline
Registered User
  
 

Join Date: Oct 2005
Location: UK
Posts: 8
Use autoexpect
# autoexpect <return>
#scp/ssh xxx@xx <return>
#password:*****
#ctrl d
it will automatically generate script.exp in the current directory and u can call that script from shell script.
Basically autoexpect logs key strokes and generates the script.
Hope this helps
  #4 (permalink)  
Old 10-09-2008
jagnikam jagnikam is offline
Registered User
  
 

Join Date: Jan 2008
Posts: 56
I am using Ubuntu & these commands are not available in my OS. I have not authority install any softwares on servers.
  #5 (permalink)  
Old 10-09-2008
jagnikam jagnikam is offline
Registered User
  
 

Join Date: Jan 2008
Posts: 56
####################my_shell_script.exp #################
#!/usr/bin/expect -f

exp_internal 1

spawn /usr/bin/scp -i /root/Test/abcds test.txt root@192.168.1.6:/tmp/
expect "*?assword:*"
send "pass_word\r"
send -- "\r"
expect eof


###################Output ###########################

spawn /usr/bin/scp -i /root/Test/abcds test.txt root@192.168.1.6:/tmp/
parent: waiting for sync byte
parent: telling child to go ahead
parent: now unsynchronized from child
spawn: returns {4384}

expect: does "" (spawn_id exp7) match glob pattern "*?assword:*"? no
expect: timed out
send: sending "pass_word\r" to { exp7 }
send: sending "\r" to { exp7 }
pass_word

expect: timed out


can anybody guide me whats wrong in this script ?

Thanks In Advance

Last edited by jagnikam; 10-10-2008 at 04:06 PM..
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 07:28 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0