Re: [SLUG] automating bash password entry

From: Ronan Heffernan (ronanh@auctionsolutions.com)
Date: Thu Apr 22 2004 - 17:34:53 EDT


Mike Branda wrote:

>To all the programming hero's, I have a bank of 50 redhat 8.0 animation
>rendering machines that occasionally need to be restarted due to a loss
>of connection to a samba share and a few other things. I've created a
>simple shell script that ssh's into the farm boxes, and fires off the
>restart command, but when I run the script, of course it asks for the
>user password at each machine. after the password is entered, it runs
>the rest of the script (i.e. the shutdown command) in the background and
>proceeds to ask me for each and every password down the line. is there
>a way to enter the password once at the beginning and store it as a
>response to the rest of the machines? or just store it period and I'll
>give the script root only privileges. it's lousy having to enter 50 of
>the same password.
>
>any help in the right direction is much appreciated.
>
>thanks!!
>
>Mike Branda
>
>
Assuming that I understand correctly:

   It is not BASH that is asking for the password, it is the remote SSH
daemon (actually, technically it is your ssh client). You can generate
a pair of keys (public and private) and install them on these machines
(check a FAQ on ssh). If this is done correctly, you can type: ssh
machinename , and you will get a command-prompt with no password
(note: you must generate this pair of keys *without* a pass-phrase, else
you will need to enter the pass-phrase to use the key (no advantage)).
You can also use the rsh-ishness of ssh in this way:

   ssh ronan@myserver.com "shutdown -h now"

--ronan

-----------------------------------------------------------------------
This list is provided as an unmoderated internet service by Networked
Knowledge Systems (NKS). Views and opinions expressed in messages
posted are those of the author and do not necessarily reflect the
official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 16:41:30 EDT