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

I am trying to write a perl script that will take info from a form, write it to a file. Then using SCP, connect to another server and transfer the file. My question is, I need to know the perl commands to start SCP and wait for the password prompt, then send the password.
  • Comment on Is it possible to automate a login with perl

Replies are listed 'Best First'.
Re: Is it possible to automate a login with perl
by arturo (Vicar) on Mar 09, 2001 at 23:09 UTC
    I Expect there's something out there that might fit the bill ... =)
Re: Is it possible to automate a login with perl
by reyjrar (Hermit) on Mar 10, 2001 at 00:33 UTC
    Also, if you're using SCP, you might want to consider creating a "script user" on the remote system and enabling hostkey authentication between the two boxes. This will eliminate the need for you to "expect" anything and save passwords for accounts in your perl script. I was really intrigued by this module as far as SSH is concerned. Unlike Net::SSH, Net::SSH::Perl doesn't use IPC::Open3 or Expect. I haven't read too much into, so I'm not sure if it supports SCP yet, but DEFINATELY worth keeping an eye on.

    -brad..
Re: Is it possible to automate a login with perl
by arhuman (Vicar) on Mar 09, 2001 at 23:09 UTC
    Use the expect module.