#!/usr/bin/perl use Net::SSH::Perl; use strict; print(qq(Content-Type: text/html\n\n)); print(qq(Remote Test)); &list_directory(); print(qq()); exit; sub list_directory { my(%ssh_params) = ( 'port' => '40001', ); my($hostname) = '12.345.67.890'; my($ssh_username) = 'root'; my($ssh_password) = 'noneya'; my($command) = qq(ls -l); print(qq(creating ssh connection
\n)); my($ssh) = Net::SSH::Perl->new($hostname), %ssh_params); print(qq(logging in
\n)); $ssh->login($ssh_username, $ssh_password); print(qq(running command: $command
\n)); my($stdout, $stderr, $exitval) = $ssh->cmd($command); print(qq(directory listing: $stdout
\n)); } 1;