2
use Net::SSH::Perl;
my $ssh = Net::SSH::Perl->new('$host',22);
$ssh->login('$user','$pass');
my $out = $ssh->cmd("show clock");
print $out;

I have the above script to have an ssh session using perl but I'm having the error message "Can't map service name 'ssh' to port number". I'm using Windows OS. Please advise me where I'm wrong.

1
  • 7
    Are you really putting the variables between single quotes? They won't get interpreted then... Commented Jul 8, 2010 at 6:30

1 Answer 1

1

Try adding ssh to your services file. The services file is located at:

%SystemRoot%\system32\drivers\etc\services

The line that you'll want to add will look like:

ssh 22/tcp  # Secure Shell Login
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.