Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^2: net::ssh::expect net::scp::expect problem

by atcroft (Abbot)
on Oct 08, 2015 at 16:16 UTC ( [id://1144198]=note: print w/replies, xml ) Need Help??


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

Since you state that when you manually ssh you are not asked for a username/password, it sounds as if you are logging in with the same username as on the local machine with a public key pair. In that case, in place of the login() call you may do something like this:

# $wait_time previously defined, in seconds # $password previously defined if ( ! $ssh->run_ssh() ) { if ( $ssh->waitfor( "ontinue connecting", $wait_time ) ) { $ssh->send("yes"); } if ( $ssh->waitfor( "ssword", $wait_time ) ) { $ssh->send( $password ); } if ( $ssh->waitfor( "ast login", $wait_time ) ) { # logged in } else { # unexpected error return undef; } } # connected, continue on your way

Hope that helps.

Update: 2015-10-07
Changed variable name to make snippet more readable.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2024-04-19 06:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found