Running Remote using Perl CGI

srinumar nginx-forum at
Mon Jan 19 09:56:35 UTC 2015

Hello All,

I have Perl CGI  Script which is running the command on the Remote command
and display output on the webpage.Script is failing with below error.....

cannot connect to filer  at /var/www/cgi-bin/export.cgi line

Same Script works fine when i run the script from the command prompt...

Apache  running with the "deamon" user.As we have standard apache
configuration,It's not possible for me change the apache
configuration(apache user,path change).
I need to run the similar command on 1000+ storages.already ssh keys enabled
for  the root user.So i would like use  "root" user  to run the remote

I have given the complete script below..

use CGI;
use CGI::Carp qw(warningsToBrowser fatalsToBrowser);
use Net::OpenSSH;
my $hostname="";
my %opts = (
                user => "root",
                key_path => "/root/.ssh/id_rsa",
                strict_mode => 0
$obj=new CGI;
my $ssh=Net::OpenSSH->new($hostname,%opts);
$ssh->error and die "cannot connect to filer $hostname ";
print $obj->header(),
$obj->start_html(-title=>'Export Script'),
$obj->center($obj->h2('Export list')),
$obj->start_html(-title=>'Export Script'),
$obj->center($obj->h2('Export Script')),

it's completly blocking my work.Please help me asap.

Posted at Nginx Forum:,256190,256190#msg-256190

More information about the nginx mailing list