Loading ...
Sorry, an error occurred while loading the content.
 

RE: [PBML] Perl SSH issues

Expand Messages
  • Robert Lee Binkley
    If all you need to do is run a command on a remote host then my @host_files_in_tmp = qx(ssh user@host ls /tmp); #!/usr/bin/perl use strict; use warnings; use
    Message 1 of 2 , Jun 9, 2009
      If all you need to do is run a command on a remote host then



      my @host_files_in_tmp = qx(ssh user@host ls /tmp);



      #!/usr/bin/perl

      use strict;
      use warnings;
      use CGI qw/:standard/;
      use CGI::Carp qw(fatalsToBrowser warningsToBrowser);
      use Net::SSH::Perl;
      use Data::Dumper;

      $|++;

      my $imap1 = 'imap1';
      my %params = (debug => 1, protocol => 2);

      print header(),
      start_html(),
      "creating ssh object: ", scalar localtime, br;

      warningsToBrowser(1);

      my $ssh_imap1 = Net::SSH::Perl->new($imap1, %params) || die "can't ssh $!";
      print "ssh object created: ", scalar localtime, "<br>$/";

      print "logging in: ", scalar localtime, br;
      $ssh_imap1->login('me');
      print "logged in: ", scalar localtime, br;

      my ($stdout, $stderr, $exit) = $ssh_imap1->cmd('pwd');
      $stdout =~ s/\n/<br>/g;

      print "<br>$stdout",
      end_html();



      Hope this helps



      From: perl-beginner@yahoogroups.com [mailto:perl-beginner@yahoogroups.com]
      On Behalf Of Dukelow, Don
      Sent: Tuesday, June 09, 2009 8:39 AM
      To: perl-beginner@yahoogroups.com
      Subject: [PBML] Perl SSH issues








      I've used Perl SSH on a number of occasions in the past but nothing series.
      Now I need to get series, does anyone know some good web sights I can go to
      get some good how to's in Perl SSH? Plus some good examples of programs?

      -----
      Don Dukelow





      [Non-text portions of this message have been removed]
    Your message has been successfully submitted and would be delivered to recipients shortly.