Solved

SSH Login Script

Posted on 2003-11-12
3
24,781 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 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

Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

Question has a verified solution.

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

If you're not part of the solution, you're part of the problem.   Tips on how to secure IoT devices, even the dumbest ones, so they can't be used as part of a DDoS botnet.  Use PRTG Network Monitor as one of the building blocks, to detect unusual…
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.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

726 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