Hi I am trying to get a connection from windows a unix box and just pass an ls command. The execution just hangs without any output. What might be wrong?
#!/usr/bin/perl -w
use strict;
use Net::SSH::Perl;
my $hostname = "unixhost";
my $username = "####";
my $password = "######";
my $cmd = shift;
my $ssh = Net::SSH::Perl->new("$hostname", debug=>1, identity_files => []);
$ssh->login("$username","$password");
my ($stdout,$stderr,$exit) = $ssh->cmd("$cmd");
print $stdout;
exit;
*> C:>perl ssh.pl “ls -ltr”
WXVM0026: Reading configuration data
c:/.ssh/config WXVM0026: Reading configuration data /etc/ssh_config
WXVM0026: Connecting to themse, port 22. WXVM0026: Remote protocol
version 1.99, remote software version
OpenSSH_4.5p1+sftpfilecontrol-v1.1-hpn12v14 WXVM0026: Net::SSH::Perl
Version 1.34, protocol version 1.5. WXVM0026: No compat match:
OpenSSH_4.5p1+sftpfilecontrol-v1.1-hpn12v14. WXVM0026: Connection
established. WXVM0026: Waiting for server public key. WXVM0026:
Received server public key (768 bits) and host key (1024 bits).
WXVM0026: Host ‘themse’ is known and matches the host key. WXVM0026:
Encryption type: DES3 WXVM0026: Sent encrypted session key. WXVM0026:
Received encryption confirmation. WXVM0026: Doing challenge response
authentication. Password: Password: WXVM0026: Sending command: ls -ltr
WXVM0026: Entering interactive session.*
If the remote command does not close its input/output/stederr the SSH session waits for its input forever (at least until its timeoouts).
Regards,