Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Net::SSH::Perl Error Can't map service name 'ssh' to port number

Status
Not open for further replies.

waiterm

Programmer
May 17, 2004
236
GB
Hi,

I'm using the following code:
Code:
4.   use Net::SSH::Perl;
5.   use lib "C:/tmp/LIB";
6.   require "funcs.pl";
7.   
8.   $host = "xx.x.xx.xx";
9.   $user = "Xxxx";
10.  $pass = "xxxxxX";
11. 
12.  my $ssh = Net::SSH::Perl->new($host);
13.  $ssh->login($user, $pass);
14.  $cmd = "mysql -p -A";
15.  my($stdout, $stderr, $exit) = $ssh->cmd($cmd);
And receiving the following error:
Code:
Can't map service name 'ssh' to port number at C:\tmp\LIB\SSH_test.pl line 12
I'm running the script on Windows XP Pro using ActivePerl 5.8.0, I've tried Net::SSH::W32Perl with no joy either. I believe it has something to do with the services running in the background in Windows, but I have absolutely no idea about how to add 'SSH' as a new service. If anyone has any ideas then I would greatly appreciate the help as I need this script to work as a matter of urgency.

I have googled but without any helpful results.

Thanks in advance.

Rob Waite
 
Many thanks Paul, that appears to be working, however I now get the following error even though Math::GMP is installed:
Code:
Can't locate loadable object for module Math::GMP in @INC (@INC contains: c:/tmp
/LIB C:/tmp/LIB C:/Perl/lib C:/Perl/site/lib .) at C:/Perl/site/lib/Net/SSH/Perl
/Util/SSH1MP.pm line 7
Compilation failed in require at C:/Perl/site/lib/Net/SSH/Perl/Util/SSH1MP.pm li
ne 7, <GEN0> line 1.
BEGIN failed--compilation aborted at C:/Perl/site/lib/Net/SSH/Perl/Util/SSH1MP.p
m line 7, <GEN0> line 1.
Compilation failed in require at C:/Perl/site/lib/Net/SSH/Perl/Util.pm line 56,
<GEN0> line 1.
BEGIN failed--compilation aborted at C:/Perl/site/lib/Net/SSH/Perl/Key/RSA1.pm l
ine 6, <GEN0> line 1.
Compilation failed in require at C:/Perl/site/lib/Net/SSH/Perl/SSH1.pm line 13,
<GEN0> line 1.
BEGIN failed--compilation aborted at C:/Perl/site/lib/Net/SSH/Perl/SSH1.pm line
13, <GEN0> line 1.
Compilation failed in require at C:/Perl/site/lib/Net/SSH/Perl.pm line 55, <GEN0
> line 1.

Rob Waite
 
IS there a prerequisite version number of Math::GMP (?whatever that is). I'd try removing Math::GMP, and reinstalling via either CPAN or PPM, whichever works

;)--Paul

cigless ...
 
It looks as though the module has an 'XS' component which needs compiling in C...which I know nothing about how to do. So it looks like game over so far as Math::GMP is concerned. Would it be possible to get hold of the pre-compiled C files? Or is there any other workaround?

Rob Waite
 
search on google for Math-GMP.ppd, and point your ppm at that repository, or download the file, and install the binary locally is all I can think of

--Paul

cigless ...
 
Ok, am another step closer, Math::GMP was installing in lib/GMP/ directory as opposed to lib/Math/GMP/, I've moved the files installed by PPM and now get the following error:
Code:
Can't find 'boot_Math__GMP' symbol in C:/Perl/site/lib/auto/Math/GMP/GMP.dll at C:/Perl/site/lib/Net/SSH/Perl/Util/SSH1MP.pm line 7
I'm extremely grateful for all your help Paul.

Rob Waite
 
is the DLL any longer at that locn
--Paul

cigless ...
 
Many thanks for your help Paul, I have in the end managed to find a simple workaraound for the time being...and it doesn't involve Perl! I used the SSH Shell Client's session logging feature to spit the necessary information out into a text file...which I should have done to begin with unfortunately the lateral thinking part of my brain took about 6 hours to kick in! Hey-hoe!

I've given you a star anyway for all your time and help.

Rob Waite
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top