http://www.perlmonks.org?node_id=942165


in reply to tty Problem while executing command's with sudo over Net::SSH2

A little demo for Net::SSH2 Try using the shell method:

my $chan = $ssh->channel(); $chan->blocking(0); $chan->shell(); print $chan "sudo -u bob date\n"; print "LINE : $_" while <$chan>; $chan->close;