$socket ->connect($host) or die("connect(): $!\n"); # establish the connection print "Connection to Server established \n"; $session->auth_password($luser,$pw); if ($session->auth_ok()) { $channel =$session->channel(); # shell command print $channel "uname -a\n"; while ($channel->read($resp,1024)) { print $resp; } $channel->close(); $session->disconnect(); } else { print STDERR "authentication failed\n"; }