Re: Question on input password on ssh prompt



On Sep 17, 10:23 am, Ben Morrow <b...@xxxxxxxxxxxx> wrote:
Quoth "J. Gleixner" <glex_no-s...@xxxxxxxxxxxxxxxxxxxxx>:

Mav wrote:

In fact, The actual script I am working actually first generates the
public key on the PC side(for that PC), then append the public key
into linux (.ssh/authorized_key) entry thru ssh command. So next time,
if the PC invokes a command from the PC to linux side thru ssh, it
will not prompt the password. Any suggestion?

You have to authenticate to have SSH work. That authentication
can be public key or by providing the password. You might want
to look at the Expect module, to automate the initial authentication
with the password. Probably the best route is if the ssh keys don't
exist, then to have the script prompt for the password when it
runs, and have it pass it to SSH, using Expect.

No, that won't work, as Expect requires ptys, which WinXP doesn't have.
I think the OP's best way forward is to try Net::SSH::W32Perl, which can
log in with a password.

Ben

Thanks, Ben
I looks into the Net::SSH::W32Perl, when I tried to use that I got the
error:

use Net::SSH::W32Perl;
my $ssh = new Net::SSH::W32Perl($host, protocol => 2, debug=>1);

The getpwuid function is unimplemented at C:/Perl/site/lib/Net/SSH/
Perl.pm line
110.

line 110 on Perl.pm regarding to environment variable $HOME on PC. Do
you encounter the same problem? That means that I have to set the
$HOME in my script?

Thanks,
Mav



.



Relevant Pages