Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Anyone care to write a perl script that can use Net::SSH::Perl to ask for a password and passphrase then use Net::SSH::Perl to use the password function for the initial login and the passphrase to create a key on the server with a passphrase. This is for open SSH version 2 using des3. The advantage to this is one could set up secure shell keys on a large number of servers in a from a host list in a few minutes versus hours and hours. I am pretty sure it can be done. I have seen it done in KSH but it lacks the password answering and passphrase answering. Expect is not a very secure way to fix that which is why I am looking at using this module. Thanks looking forward to replies

2006-04-22 Retitled by Corion, as per Monastery guidelines
Original title: 'Net::SSH::Perl'

  • Comment on Use Net::SSH::Perl to ask for a password and passphrase

Replies are listed 'Best First'.
Re: Use Net::SSH::Perl to ask for a password and passphrase
by Limbic~Region (Chancellor) on Feb 24, 2003 at 22:49 UTC
    Anonymous Monk,
    Normally, I would reply as dbp did and suggest that you go to a site where paying for code you are not willing to put forth the effort in is the norm.

    But, I know who you are and that you have actually put forth a lot of effort in the CB today trying to accomplish this task. I think part of your problem is that you didn't take the advice of the people in the CB and post the KSH code along with this post.

    You are much more likely to get a positive response if you say:
    Hey everyone! I am trying to convert this KSH script over to Perl because I do not know how to fully automate it in KSH (send passwords/passphrases at appropriate time).

    #!/usr/bin/ksh # CODE GOES HERE

    What I have so far is:

    #!/usr/bin/perl -w use strict; # CODE GOES HERE

    But what I can't seem to figure out is how to <fill in the blank>.

    This allows people to see the context of the problem, offer advice on what you want to do - or more often than not - point you to a module that already does what you are trying to accomplish.

    I think you will make a fine addition here at PM, but you really should spend some time here reading all the wonderful documentation.

    Looking forward to seeing the KSH code and what you have come up with so far in Perl.

    Cheers - L~R

      ++Limbic~Region. I think what really precipitated my response was the first line. If the OP had said "Anyone care to help me write a perl script..." rather than "Anyone care to write a perl script..." I would have badgered her for code rather than dismissing her offhand. To the OP, sorry I was so gruff and I look forward to seeing what you have so far.
Re: Use Net::SSH::Perl to ask for a password and passphrase
by dbp (Pilgrim) on Feb 24, 2003 at 22:23 UTC