Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: net::ssh::expect net::scp::expect problem

by shadowsong (Monk)
on Oct 07, 2015 at 22:22 UTC ( #1144109=note: print w/replies, xml ) Need Help??


in reply to net::ssh::expect net::scp::expect problem

Hi bigswifty00000

Without seeing the code to carry out the scp it's difficult to diagnose why the error you've displayed has occurred.

Re: Uncaught exception from user code: SSHAuthenticationError Login timed out it appears you've timed out before a successful login...

On the server that you're attempting to connect to; what is the LoginGraceTime field set to in your sshd_config file? (It might be a quick fix to simply increase this value, but I wouldn't go that route until we know for sure you can indeed perform a simple user/password authentication connection).

Are you able to achieve a basic login using something like this?

#!/usr/bin/perl use strict; use warnings; use Net::SSH::Expect; # create an SSH connection object with user,password auth my $ssh_conn = Net::SSH::Expect->new( host => '192.168.0.4', # server ip user => 'john', # user password => 'password123', # password raw_pty => 1 ); # use the SSH connection object to attempt a logon to our # SSH server using the local SSH client my $login_session = $ssh_conn->login(); die "Login attempt failed. Output: $login_session\n" if $login_session + !~ /Last login/; # arrival here signifies a successful login print "You are now logged in!\n"; # close the SSH connection $ssh_conn->close(); __END__

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1144109]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (8)
As of 2019-05-23 19:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you enjoy 3D movies?



    Results (146 votes). Check out past polls.

    Notices?
    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!