in reply to Expect & SSH
You want to disable copying output STDOUT with $conn->log_user( 0 ) (possibly re-enabling it after you've logged in to show the output from whatever it is you're running).