Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Perl (NET::SSH2 on Windows)

  • 18-05-2008 05:55PM
    #1
    Registered Users, Registered Users 2 Posts: 9,579 ✭✭✭


    Hi There,

    Before I go crazy, has anyone actually got SSH to work on a Windows Platform?

    I've tried Net::SSH::Perl and Net::SSH::W32Perl modules but they were a nightmare with all the dependencies on all the Math Modules which seem impossible to install? - so I tried Net::SSH2.

    With this you must have OpenSSL installed which I have no problem, and libssl. Problem with libssl is I must compile it - having difficulty there and seems to be no compiled binary version anywhere!

    I'm about to give up getting SSH working via Perl - I need to remotely log into a machine and run a command. I was thinking maybe doing it in something else such as C and then just calling this from the Perl script and retrieving the result from the command executed on the machine.

    Just wondering if anyone has any ideas? - this is horrible!


Comments

  • Registered Users, Registered Users 2 Posts: 9,579 ✭✭✭Webmonkey


    Ok I discovered the problem and I'll give the solution.

    You must use ActiveState Perl Version 5.8 - ActivePerl-5.8.8.822-MSWin32-x86-280952.msi (I had the latest version) Once you have this done you must then use ppm to install the modules. Don't do it manually.

    cmd>ppm install http://theoryx5.uwinnipeg.ca/ppms/Net-SSH-W32Perl.ppd

    This will give you all the dependencies such as Math::GMP / Pari / All the Crypto stuff etc. These can all be installed from that site.

    I've finally got everything working.
     use Net::SSH::W32Perl;
     $ENV{HOME} = "C:/";
     my $host = 'localhost';
     my $ssh = new Net::SSH::W32Perl($host);
     print $ssh->login('administrator', '');
    

    Havn't done much with regards to commands and retrieving the output etc but I can see this being incredibly useful.

    Hope this helps others.


  • Closed Accounts Posts: 1,444 ✭✭✭Cantab.


    Webmonkey wrote: »
    Hi There,

    Before I go crazy, has anyone actually got SSH to work on a Windows Platform?

    I've tried Net::SSH::Perl and Net::SSH::W32Perl modules but they were a nightmare with all the dependencies on all the Math Modules which seem impossible to install? - so I tried Net::SSH2.

    With this you must have OpenSSL installed which I have no problem, and libssl. Problem with libssl is I must compile it - having difficulty there and seems to be no compiled binary version anywhere!

    I'm about to give up getting SSH working via Perl - I need to remotely log into a machine and run a command. I was thinking maybe doing it in something else such as C and then just calling this from the Perl script and retrieving the result from the command executed on the machine.

    Just wondering if anyone has any ideas? - this is horrible!

    I've not much experience with Perl modules on Windows...

    I imagine it's a straightforward case of general module installation? (But as we all know with Perl, 1-2% of the time, the installation can be a bit hariy)

    What errors are you getting?

    Have you set your PERL5LIB path correctly? You need to point to the ./blib/lib directory (sometimes you also need to point to the directory containing relevant .so files)


  • Registered Users, Registered Users 2 Posts: 9,579 ✭✭✭Webmonkey


    ^ Just after sorting the problem in my 2nd post :) - Cheers anyways.


Advertisement