#!/usr/bin/env perl use strict; use warnings; use Net::OpenSSH; use Expect; my $timeout = 20; my $ssh = Net::OpenSSH->new('walkingthecow@remote_host', password => 'PkDDaDoES$551890'); # not really my password ;) my ($pty, $pid) = $ssh->open2pty("ls /etc") or die "open2pty failed: " . $ssh->error . "\n"; my $expect = Expect->init($pty); $expect->raw_pty(1); $expect->log_stdout(1); while(<$pty>) { print "$_" }