Solved

ksh secure copy (scp) - catch password prompt

Posted on 2007-11-15
3
2,050 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Over the years I've spent many an hour playing on hardened, DMZ'd servers, with only a sub-set of the usual GNU toy's to keep me company; frequently I've needed to save and send log or data extracts from these server back to my PC, or to others, and…
Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
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.
Suggested Courses

636 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