finfan has asked for the wisdom of the Perl Monks concerning the following question:
I'll start with the code.
#! /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->run_ssh() or die "SSH process couldn't start : $!"; $ssh -> exec("stty raw -echo"); print "Running ls -l\n"; my $ls = $ssh->exec("ls -l /"); print "ls = $ls"; $ssh->close();
I get no errors, but ls is not returning anything. Tried $ssh->exec("touch /tmp/foo"); and a file was NOT created.
Ideas?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Net::SSH::Expect problem
by blue_cowdawg (Monsignor) on Mar 20, 2013 at 19:57 UTC | |
|
Re: Net::SSH::Expect problem
by Khen1950fx (Canon) on Mar 20, 2013 at 22:47 UTC | |
|
Re: Net::SSH::Expect problem
by rnewsham (Curate) on Mar 20, 2013 at 20:56 UTC | |
|
Re: Net::SSH::Expect problem
by rnewsham (Curate) on Mar 20, 2013 at 20:11 UTC |