Re: [SLUG] automating bash password entry

From: Austin Theen (austin@austintheen.com)
Date: Thu Apr 22 2004 - 16:42:52 EDT


On Thu, 2004-04-22 at 15:54 -0400, 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.

What you need to eliminate the ssh password is a simple little program
from the Linux Userland File System called 'lussh'. What the little
program does for you is really pretty simple. It adds your public key to
the ~/.ssh/authorized_keys file. which essential tells the sshd server
to trust the system with that public key.

I suppose one of the craftier linux dieties will chime in about how you
can do this in a 3 line perl script.

Here is the Linux Userland File System
websitehttp://lufs.sourceforge.net/

> austin@bender austin $ lussh
>
> This script will help you setup ssh public key authentication.
> SSH server: testserver
> user[username]:
> Setting up RSA authentication for username@testserver...
> RSA public key OK.
> id_rsa.pub 100% 239 0.2KB/s 00:00
>
> You should see the following message without being prompted for anything now...
>
> !!! Congratulations, you are now logged in as username@testserver !!!
>
> If you were prompted, public key authentication could not be configured...

-----------------------------------------------------------------------
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:05 EDT