babp has asked for the wisdom of the Perl Monks concerning the following question:

Hi , Please help me for this authentication erroror: I am trying to ssh to a client(est21.ind.bg.com) using Net::SSH::Expect . As per the log login is successful but getting following error .I tried with diffrent timeout value also. SSHAuthenticationError Login timed out. The input stream currently has the contents bellow: Last successful login: Mon Oct 24 13:46:07 IST 2011 est.ind.bg.com Last authentication failure: Sun Oct 23 23:46:03 IST 2011 nanditha.ind.com Last login: Mon Oct 24 13:46:07 2011 from est.ind.bg.com You have mail. Value of TERM has been set to "xterm". WARNING: YOU ARE SUPERUSER !! est21# at /opt/perl_64/lib/site_perl/5.8.8/Expect.pm line 787
  • Comment on Net::SSH::Expect error .SSHAuthenticationError Login timed out

Replies are listed 'Best First'.
Re: Net::SSH::Expect error .SSHAuthenticationError Login timed out
by salva (Canon) on Oct 25, 2011 at 16:28 UTC
    It seems that your login succeeds. Maybe public key authentication has already been set up and you don't need to log at all.

    Anyway, post your code. Otherwise is not possible to really know what you are doing wrong.

    And, BTW, why are you using Net::SSH::Expect? usually it is not the best alternative.

      Hello salva,

      What is a better alternative to Net::SSH:Expect?

      I use it but don't know any better.

      Thanks,
      Rob

        Nowadays, Net::SSH2 or Net::OpenSSH are probably your best options unless you are connecting to one of those routers or switches that only provided a crippled restricted shell or a broken SSH implementation. In that case, Net::Telnet (its docs explain how to use it over SSH) or even just Expect are in my opinion the way to go.

        Net::SSH::Expect is just not reliable, specially over slow networks, due to the feeble way it uses to detect when remote commands finnish.

Re: Net::SSH::Expect error .SSHAuthenticationError Login timed out
by williams554 (Sexton) on Oct 26, 2011 at 00:16 UTC

    You are getting in.

    string log_file
    Used as argument to the internal Expect->log_file() method. Default is no logfile.

    I would guess after expect logged in it never got what it was waiting for and just waited till it timed out.

    I agree... It would be helpful to see the code and a log of what is happening.

    Good Luck, Rob