#!/usr/local/bin/perl -w use strict; use Net::SSH::Perl; use Data::Dumper; my $ssh = Net::SSH::Perl->new( "localhost", debug => 1, protocol => 2, interactive => 1, use_pty => 1 ); $ssh->login(); my ($out, $err, $exit ) = $ssh->cmd('su - root -c "touch /var/tmp/silly3"', '*******'); print "out = $out\nerr = $err\nexit = $exit\n";