Linux Help
guides forums blogs
Home Desktops Distributions ISO Images Logos Newbies Reviews Software Support & Resources Linuxhelp Wiki

Welcome Guest ( Log In | Register )



Advanced DNS Management
New ZoneEdit. New Managment.

FREE DNS Is Back

Sign Up Now
 
Reply to this topicStart new topic
> Using Ssh W/ Password In Shell Scripts
cmcp
post Jul 15 2003, 04:50 PM
Post #1


Whats this Lie-nix Thing?
*

Group: Members
Posts: 21
Joined: 15-July 03
Member No.: 1,107



I have written a shell script that simply tests using SSH to log in to multiple computers sequentially. The computer names are input from a file. SSH is using password authentication, which means that when the script runs, it asks for the password before logging in to every node in the file. So far the script is as follows:

#!/bin/sh
for eachhost in `cat $1`
do
echo "Testing $eachhost"
ssh root@$eachhost cd /home
done

It's a simple script and all I would like to know is how to put passwords in the script so that I don't have to manually enter them for every computer.

Alternatively, if you know of a way to include the passwords in the input file (that has the computer names, so that the file would then contain name/password pairs) and to use them to login in the script, that would be just as good if not better.

Thanks in advance for your help!
Go to the top of the page
 
+Quote Post
chrisw
post Jul 16 2003, 11:15 AM
Post #2


RMS is my Hero
******

Group: Admin
Posts: 634
Joined: 27-September 02
From: Louisiana
Member No.: 5



you would use private and public key files to eliminate the use of having to use a password to login.....doing this
allows for automated logins....but doesnt ELIMINATE the use of passwords....


--------------------

Chris W.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 12th December 2017 - 08:44 PM