Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

SSH Login Script

Posted on 2003-11-12
3
24,775 Views
Last Modified: 2013-12-23
I have research a few things and have ideas about this, so for me to accept an answer, I will need a fairly detailed answer ( but I will award more points if needed to accomplish this ).

I have used public key based authentication with SSH before and though it is a good solution, it is not the right solution for this issue.  I have hundreds of server that I wish to ssh to serially in a script... I want the script to prompt me for a password like:

echo Enter your passwd
stty -echo
read PASSWORD
stty echo

and I want to be able to pass that result as an environment variable of parameter to SSH.  I have done this successfully with FTP and with RSYNC.

I had considered and played with ssh-agent ( which would have been great ), but I even after I ssh-add ed my private key, it continues to prompt me on the remote hosts for login, which just won't fly with having to login several hundred times.  So maybe I could also get along with a fix or better understanding of why my ssh-agent is not working properly, but I would also like to know if I can simply read input and pass it to SSH.

0
Comment
Question by:stewbeast
  • 2
3 Comments
 
LVL 40

Assisted Solution

by:jlevie
jlevie earned 100 total points
ID: 9735832
From your question it sound like this is probably a job for expect, but I'd need to know more about what your script will be doing to be able to propose a solution.
0
 
LVL 38

Accepted Solution

by:
yuzh earned 150 total points
ID: 9736271
Agreed with  jlevie ,

    If you do want to setup ssh without password, you need to use "expect" script to handle the
password, if you don't know kow to write an expect script, use autoexpect to create one for you.

man autoexpect

to learn more.

In case you don't have expect install on your system, you need to download it for you version
of OS, You should also get tcl , tk installed on your system.  (just do a search on the web, you
can find them)

information about expect (including script example can be found):

http://expect.nist.gov/

you can also use "autoexpect" to create an expect script for you and then modify
the script
man autoexpect

Have a look at the following example to get soem idea about expect script:
http://oldlook-search.experts-exchange.com/Operating_Systems/Linux/Q_20476614.html

if you want more help for the expect script, please let us know how would you use the
script, eg, commandline format, args (hostname, login-name, passwd etc) to pass to the script .


0
 
LVL 38

Expert Comment

by:yuzh
ID: 9761620
How's it going, need more help?
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Let’s list some of the technologies that enable smooth teleworking. 
Don’t let your business fall victim to the coming apocalypse – use our Survival Guide for the Fax Apocalypse to identify the risks and signs of zombie fax activities at your business.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question