Solved

ksh secure copy (scp) - catch password prompt

Posted on 2007-11-15
3
2,043 Views
Last Modified: 2013-12-26
I'm writing a korn shell script that includes automatic secure copying of a file to several servers.  If the current user is not configured for scp on the server, it will prompt for a password.  I'd like to catch this prompt and end the scp call if the prompt occurs.  Any help would be greatly appreciated!
0
Comment
Question by:trinity12583
[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
3 Comments
 
LVL 40

Accepted Solution

by:
omarfarid earned 500 total points
ID: 20290699
Hi,

For this, use expect. The links below are useful in learning expect. You may download expect from the home page if not already available on your m/c.

http://expect.nist.gov/
http://www.csc.calpoly.edu/~dbutler/tutorials/winter96/expect/tutorial.html
http://www.linuxjournal.com/article/3065
http://expect.nist.gov/example/autoexpect.man.html


0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 20290954
i.g. ssh-keygen is the way to go
If that is not possible then expect will be best.
0
 

Author Closing Comment

by:trinity12583
ID: 31409353
I was able to use the resources you gave to get a basic understanding ot Tcl and Expect and wrote a small script to accomplish what I needed in less than an hour!  Thanks so much!  :-)
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

734 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