[ic] Generating Keys & Applying Signatures

Ron Phipps interchange-users@lists.akopia.com
Wed Jun 27 18:37:00 2001


> Hi Zack,
>
> I have read through the manual for Expect. I have to admit that I am very
> new to this. Is it possible for u to give me some sample scripts on using
> Expect to do PGP keys generation to get me started, or at least, let me
know
> where to get them.
>
> Thanks very much!

Hello,

I have included a clip of some code that uses Expect.  This is ran from the
command line by our account creation script.  It takes the output from a
random string generator and stuffs the input into 'passwd' which is normally
interactive.  I hope this gives you some ideas.

See ya,
-Ron

#!/usr/bin/expect -f
# wrapper to make passwd(1) be non-interactive
# username is passed as 1st arg, passwd as 2nd

set force_conservative 1
set password [lindex $argv 1]
spawn passwd [lindex $argv 0]
sleep .1
expect "password:"
sleep .1
send "$password\r"
sleep .1
expect "password:"
sleep .1
send "$password\r"
sleep .1
expect eof