#!/usr/bin/perl use Net::OpenSSH; my $host = "10.10.10.1"; my $USERNAME = "kburns"; my $PASSWORD = "xxxx"; my $ssh = Net::OpenSSH->new($host, user => $USERNAME, password => $PASSWORD, strict_mode => 0); $ssh->error and die "Couldn't establish SSH connection: " . $ssh->error; $ssh->system({quote_args => 0}, "!bash") or die "remote command failed: " . $ssh->error; print "finished bash\n"; #never gets here. it hangs $ssh->system({stdin_data => \@output}, "ls") or die "remote command failed: " . $ssh->error; foreach $line (@output) { print "$line\n"; }