in reply to Net::SSH2 Interactive command example

Are you looking for channel shell use?
#shell use my $chan2 = $ssh2->channel(); $chan2->shell(); print $chan2 "uname -a\n"; print "LINE : $_" while <$chan2>; print $chan2 "who\n"; print "LINE : $_" while <$chan2>; $chan2->close;

I'm not really a human, but I play one on earth. Cogito ergo sum a bum

Replies are listed 'Best First'.
Re^2: Net::SSH2 Interactive command example
by vdubjunkie (Novice) on Apr 18, 2008 at 18:21 UTC
    For my code to work, I had to insert a line found in another thread on this wonderful site...

    $chan2 = $ssh2->channel(); $chan2->blocking(0); print $chan2 "tail -5 /var/log/authlog\n"; print "**$_" while <$chan2>;


    Hope this might help somebody else banging their head against the wall as was I.
      Well I didn't have to bang my head too long. I just started trying Net::SSH2 a few minutes ago and hit this problem. So I fire up Super Search and there's my answer. Wonderful site, indeed. Perlmonks rocks. And a big ++ to you, vdubjunkie.

      That didn't work for me but this does:
      $chan2 = $ssh2->channel(); $chan2->blocking(0); $chan2->exec("tail -5 /var/log/authlog\n"); print "**$_" while <$chan2>;