Visit Jeremy's Blog.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 09-27-2006, 04:11 PM   #1
Registered: Jul 2004
Posts: 90

Rep: Reputation: 15
bash script: ssh to server and reply to any questions

I'm trying to write a script that will go out to multiple servers and set up a netdump install. I'm running into a problem I ran into before but never found an answer to.

There's one command i need to run, /etc/init.d/netdump propagate, that ssh's to another server. This server has never been to before in most cases, so I get the standard "do you want to accept this key" and then presented for a password. But the problem is that when I do this from a central server, I never see the prompt for password or other message. I just eventually get a "connection denied" message.

How can I get the script to automatically answer the question for me? I though a here statement would do it, but it didn't seem to.


[root@admin joebloe]# ssh server "service netdump propagate"

This is an official system, blah blah


Permission denied, please try again.
Permission denied, please try again.
[root@admin joebloe]#

Last edited by cambie; 09-27-2006 at 04:13 PM.
Old 09-27-2006, 04:19 PM   #2
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
try this...
$ man expect

but at the same time your acceptance of the rsa key is somethign purely client side, you can remove this question with the StrictHostKeyChecking option either in your /etc/ssh_config or on command line. i wouldn't recommend commiting to a config file as that'll just stay there forever though...
Old 09-28-2006, 10:44 AM   #3
Registered: Jul 2004
Posts: 90

Original Poster
Rep: Reputation: 15
ahh, I'm glad I asked. I probably should have known about this one before.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
cannot reply to mail server cylarz Linux - Networking 1 05-08-2006 11:07 AM
bash script suggestions for waiting for ssh -L iggymac Programming 4 03-22-2005 08:04 PM
Bash script programming questions dianea Linux - Newbie 4 03-03-2004 01:17 AM
post reply & submit reply buttons annehoog LQ Suggestions & Feedback 10 01-05-2004 07:43 PM
desperate...please.....reply.....x-server...... Jeffrey Linux - General 3 03-20-2001 09:52 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:09 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration