I have created a program using perl CGI where i am calling my server script which is at remote location. For that i have used OpenSSH. But when i run this script from my terminal it works fine my remote machine script also runs properly. But when i do this from Browser it doesn't works. I have used below script.
#!/usr/bin/perl use warnings; use strict; use CGI; use Net::OpenSSH; use warnings; our $cgi = new CGI; use Net::OpenSSH; my %opts = ( user => "UNAME", #password => "MYPASSWORD", strict_mode => 0, ); my $ssh = Net::OpenSSH->new("MY SERVER_IP",%opts,master_opts => [-i => "MY KEY FILE"], async => 1); $ssh->system("/root/test.sh") or die "remote command failed: " . $ssh->error;
Below are the logs from apache error logs
[Fri Jun 27 12:11:57 2014] [error] [client localhost] Permission denied (publickey,gssapi-keyex,gssapi-with-mic).\r, referer: http://X.X.X.X/cgi-bin1/test.cgi