Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

SSH Login Script

Posted on 2003-11-12
3
Medium Priority
?
24,793 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
[X]
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
  • 2
3 Comments
 
LVL 40

Assisted Solution

by:jlevie
jlevie earned 400 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 600 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

Simplify Your Workload with One Tool

How do you combat today’s intelligent hacker while managing multiple domains and platforms? By simplifying your workload with one tool. With Lunarpages hosting through Plesk Onyx, you can:

Automate SSL generation and installation with two clicks
Experience total server control

Question has a verified solution.

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

This article is a collection of issues that people face from time to time and possible solutions to those issues. I hope you enjoy reading it.
Tech spooks aren't just for those who are tech savvy, it also happens to those of us running a business. Check out the top tech spooks for business owners.
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

610 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