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

SSH not working

Expand Messages
  • Dukelow, Don
    I installed Net::SSH:Perl on a Linix system and I try to run the script below. I get the HELLO 1 message but it hangs on the login line. This is right out
    Message 1 of 4 , Apr 1, 2008
    • 0 Attachment
      I installed Net::SSH:Perl on a Linix system and I try to run the script below. I get the "HELLO 1" message but it hangs on the login line. This is right out of the doc'c for Net::SSH::Perl but it still doesn't work. I can't figure out how to trouble shoot it to fix it. Does anyone have any ideas?


      #!/usr/bin/perl
      use warnings;
      use strict;
      use Net::SSH::Perl;

      my $user = 'lmsadmin';
      my $host = 'sun1';
      my $pass = 'sun123';
      my $cmd = "uname -a";

      my $ssh = Net::SSH::Perl->new($host);
      print "HELLO 1\n";
      $ssh->login($user, $pass);
      print "HELLO 1\n";
      my($stdout, $stderr, $exit) = $ssh->cmd($cmd);

      -----
      Don Dukelow
      HP License Team
      Hewlett-Packard Company
      Tel: 810-728-3388
      e-mail: dukelow@...
    • Alexander Saydakov
      ... script below. I get the HELLO 1 message but it hangs on the login line. This is right out of the doc c for Net::SSH::Perl but it still doesn t work. I
      Message 2 of 4 , Apr 1, 2008
      • 0 Attachment
        --- In perl-beginner@yahoogroups.com, "Dukelow, Don" <dukelow@...> wrote:
        >
        > I installed Net::SSH:Perl on a Linix system and I try to run the
        script below. I get the "HELLO 1" message but it hangs on the login
        line. This is right out of the doc'c for Net::SSH::Perl but it still
        doesn't work. I can't figure out how to trouble shoot it to fix it.
        Does anyone have any ideas?

        > my $ssh = Net::SSH::Perl->new($host);
        > print "HELLO 1\n";
        > $ssh->login($user, $pass);
        > print "HELLO 1\n";
        > my($stdout, $stderr, $exit) = $ssh->cmd($cmd);

        1. Try setting $ssh->debug(1) before calling $ssh->login()
        2. Try on the command line with -v option (similar to 1)
        3. If you have control over the remote machine, try reading the log of
        sshd (server)

        /sandy
        http://myperlquiz.com/
      • Dukelow, Don
        This worked, I found out the main problem was me. It takes about 1 min. 10 sec. for this to work. I can manually type it in and get much better results and
        Message 3 of 4 , Apr 2, 2008
        • 0 Attachment
          This worked, I found out the main problem was me. It takes about 1 min. 10 sec. for this to work. I can manually type it in and get much better results and I'm only a two finger typist. The debug option didn't give me any messages. How can I figure out why it is taking so long to execute?


          -----
          Don Dukelow
          HP License Team
          Hewlett-Packard Company
          Tel: 810-728-3388
          e-mail: dukelow@...



          ________________________________
          From: perl-beginner@yahoogroups.com [mailto:perl-beginner@yahoogroups.com] On Behalf Of Alexander Saydakov
          Sent: Tuesday, April 01, 2008 8:12 PM
          To: perl-beginner@yahoogroups.com
          Subject: [PBML] Re: SSH not working


          --- In perl-beginner@yahoogroups.com<mailto:perl-beginner%40yahoogroups.com>, "Dukelow, Don" <dukelow@...> wrote:
          >
          > I installed Net::SSH:Perl on a Linix system and I try to run the
          script below. I get the "HELLO 1" message but it hangs on the login
          line. This is right out of the doc'c for Net::SSH::Perl but it still
          doesn't work. I can't figure out how to trouble shoot it to fix it.
          Does anyone have any ideas?

          > my $ssh = Net::SSH::Perl->new($host);
          > print "HELLO 1\n";
          > $ssh->login($user, $pass);
          > print "HELLO 1\n";
          > my($stdout, $stderr, $exit) = $ssh->cmd($cmd);

          1. Try setting $ssh->debug(1) before calling $ssh->login()
          2. Try on the command line with -v option (similar to 1)
          3. If you have control over the remote machine, try reading the log of
          sshd (server)

          /sandy
          http://myperlquiz.com/





          [Non-text portions of this message have been removed]
        • Alexander Saydakov
          ... min. 10 sec. for this to work. I can manually type it in and get much better results and I m only a two finger typist. The debug option didn t give me
          Message 4 of 4 , Apr 7, 2008
          • 0 Attachment
            --- In perl-beginner@yahoogroups.com, "Dukelow, Don" <dukelow@...> wrote:
            >
            > This worked, I found out the main problem was me. It takes about 1
            min. 10 sec. for this to work. I can manually type it in and get much
            better results and I'm only a two finger typist. The debug option
            didn't give me any messages. How can I figure out why it is taking so
            long to execute?

            Again, try on the command line in verbose mode (-v). If it is also
            slow, then suspect network troubles or troubles on the remote host. If
            so, it is not Perl related, and troubleshooting can vary a lot. Say,
            it could be slow or misconfigured DNS. So try with ip address instead
            of the host name. It could be any number of other issues though.

            I am surprised that you say that enabling debug mode did not result in
            any messages. It must be similar to verbose mode on the command line,
            which usually prints quite a bit. Did you set it before calling login()?

            /sandy
            http://myperlquiz.com/


            > ________________________________
            > From: perl-beginner@yahoogroups.com
            [mailto:perl-beginner@yahoogroups.com] On Behalf Of Alexander Saydakov
            > Sent: Tuesday, April 01, 2008 8:12 PM
            > To: perl-beginner@yahoogroups.com
            > Subject: [PBML] Re: SSH not working
            >
            >
            > --- In
            perl-beginner@yahoogroups.com<mailto:perl-beginner%40yahoogroups.com>,
            "Dukelow, Don" <dukelow@> wrote:
            > >
            > > I installed Net::SSH:Perl on a Linix system and I try to run the
            > script below. I get the "HELLO 1" message but it hangs on the login
            > line. This is right out of the doc'c for Net::SSH::Perl but it still
            > doesn't work. I can't figure out how to trouble shoot it to fix it.
            > Does anyone have any ideas?
            >
            > > my $ssh = Net::SSH::Perl->new($host);
            > > print "HELLO 1\n";
            > > $ssh->login($user, $pass);
            > > print "HELLO 1\n";
            > > my($stdout, $stderr, $exit) = $ssh->cmd($cmd);
            >
            > 1. Try setting $ssh->debug(1) before calling $ssh->login()
            > 2. Try on the command line with -v option (similar to 1)
            > 3. If you have control over the remote machine, try reading the log of
            > sshd (server)
            >
            > /sandy
            > http://myperlquiz.com/
            >
            >
            >
            >
            >
            > [Non-text portions of this message have been removed]
            >
          Your message has been successfully submitted and would be delivered to recipients shortly.