Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Net::SSH::Expect problem

by rnewsham (Curate)
on Mar 20, 2013 at 20:56 UTC ( [id://1024618]=note: print w/replies, xml ) Need Help??


in reply to Net::SSH::Expect problem

Having a second look I see the problem

You don't need the call to run_ssh.

This should work for you

#!/usr/bin/perl use strict; use warnings; use Net::SSH::Expect; use lib ('./subs'); use subs; my $ssh = Net::SSH::Expect->new ( host => '10.77.6.55', password => 'mypass', user => 'root', debug => 1, raw_pty => 1 ); my $login_output = $ssh->login(); if ($login_output !~ /Last login/) { die "Login Failed\n"; } $ssh->exec("stty raw -echo"); print "Running ls -l\n"; my $ls = $ssh->exec("ls -l /"); print "ls = $ls"; $ssh->close();

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (7)
As of 2024-04-26 07:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found