Solved

ksh secure copy (scp) - catch password prompt

Posted on 2007-11-15
3
2,029 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
3 Comments
 
LVL 40

Accepted Solution

by:
omarfarid earned 500 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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 Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
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.

763 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now