ksh secure copy (scp) - catch password prompt

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!
trinity12583Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
omarfaridConnect With a Mentor Commented:
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
 
ahoffmannCommented:
i.g. ssh-keygen is the way to go
If that is not possible then expect will be best.
0
 
trinity12583Author Commented:
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
All Courses

From novice to tech pro — start learning today.