#!/usr/bin/perl use warnings; use strict; use Net::SSH2; my $ssh2 = Net::SSH2->new(); print "connect fail\n" unless ($ssh2->connect('testbox')); print "password fail\n" unless ($ssh2->auth_keyboard('z','*******')); my $chan=$ssh2->channel(); $chan->shell(); print $chan "uname -a\n"; print "LINE : $_" while <$chan>; print $chan "who\n"; print "LINE : $_" while <$chan>; $chan->close; <--end-- and the output: --start--> LINE : Linux testbox 2.6.5-7.111.19-smp #1 SMP Fri Dec 10 15:10:58 UTC 2004 i686 i686 i386 GNU/Linux LINE : root pts/0 Feb 14 14:33 (robspc) <--end--