in reply to Re^3: Net::SSH::Perl script in windows - getpwuid is unimplemented
in thread Net::SSH::Perl script in windows - getpwuid is unimplemented

is that required to use in cygwin environment. also im not calling getpwuid function. here is my code
use strict; use warnings; use Net::SSH::W32Perl; my $host = 'host'; my $pass = 'pwd'; my $user = 'userid'; my $cmd = 'command'; my $ssh = new Net::SSH::W32Perl( $host, debug => 1, protocol => 2 ); $ssh->login($user, $pass); my($stdout, $stderr, $exit) = $ssh->cmd($cmd); print $stdout, "\n";
I am running this script in windows activestate perl environment. the script trace is
Reading configuration data /.ssh/config Reading configuration data /etc/ssh_config Connecting to <hostname>, port 22. Socket created, turning on blocking... Remote protocol version 2.0, remote software version OpenSSH_5.2 Net::SSH::Perl Version 1.34, protocol version 2.0. The getpwuid function is unimplemented at C:/Perl/site/lib/Net/SSH/Per +l/SSH2.pm line 39, <GEN0> line 1.

Replies are listed 'Best First'.
Re^5: Net::SSH::Perl script in windows - getpwuid is unimplemented
by Khen1950fx (Canon) on Feb 26, 2010 at 06:22 UTC
    Cygwin implements getpwuid. If you are using ActiveState, which doesn't implement getpwuid, then you'll probably have to go into the source at C:/Perl/site/lib/Net/SSH/Perl/SSH2.pm with your editor and change sub _proto_init to this
    sub _proto_init { my $ssh = shift; my $home = $ENV{HOME} || $ENV{USERNAME}; unless ($ssh->{config}->get('user_known_hosts')) { defined $home or croak "Cannot determine home directory, pleas +e set the environment variable HOME"; $ssh->{config}->set('user_known_hosts', "$home/.ssh/known_host +s2"); }
    my $home should read:
    my $home = $ENV{HOME} || $ENV{USERNAME};
        Hi thanks for the help. now i am able to run the script. This time, it is stopping at the login method... leaving me at
        ... ... Computing shared secret key. Verifying server signature. Waiting for NEWKEYS message. Send NEWKEYS. Enabling encryption/MAC/compression. Sending request for user-authentication service. Service accepted: ssh-userauth. Trying empty user-authentication request. Trying password authentication. Authentication methods that can continue: publickey,gssapi-with-mic,pa +ssword. Next method to try is publickey. Next method to try is password. Permission denied at win32.pl line 11
        I am able to connect to target system through putty ssh interface. but with script im stopped at this login... Any comments why this is happening... Appreciate your help. Thanks, Thiru
Re^5: Net::SSH::Perl script in windows - getpwuid is unimplemented
by Anonymous Monk on Jun 21, 2010 at 16:25 UTC
    I have fixed this problem on windows, I have defined a enviroment variable HOME.
      could you explain how did you set it? You mean you have set the Windows Home variable, but with what path?