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

Hi all,
I try to use net::ssh::perl to check multipel servers. write simply like that:
use Net::SSH::Perl; $host="192.20.15.3"; $user="s00ben"; $pass="*password"; my $ssh = Net::SSH::Perl->new($host); $ssh->login($user, $pass); my($stdout, $stderr, $exit) = $ssh->cmd($cmd);
But the result comes out is :
Can't map service name 'ssh' to port number at C:\buffer\r.pl line 5
What's wrong with it ?? Thx

Replies are listed 'Best First'.
Re: net::ssh::perl question
by gaal (Parson) on Jan 10, 2005 at 07:31 UTC
    Sounds like your system doesn't know how to resolve the port for service ssh. Try this:

    my $ssh = Net::SSH::Perl->new($host, port => 22);   # ssh

    Update: alternatively, teach your system about ssh to avoid this problem in the future (at least on this machine). Edit your %WINDIR%\system32\drivers\etc\services, and add this line, preferably just before the one for telnet to keep things sorted:

    ssh                22/tcp                           #Secure Shell

      Really Thx for your help!! ^^