Problem Creating Socket : Permission Denied

Problem Creating Socket : Permission Denied

am 20.08.2007 17:23:27 von vivekian

Hi,

I have a cgi script which opens a telnet session to a switch. The
script is listed below. It executes fine on command line. When i call
it via a web browser, the error log shows the following error :

problem creating socket: Permission denied at /var/www/html/vlab/cgi-
bin/init_lab.cgi line 10

Other scripts which don't have sockets execute fine.

The file permissions for init_lab.cgi are :

-rwxrwxrwx 1 apache tspradhan 634 2007-08-20 00:48 init_lab.cgi

Not sure what is being missed here.

#!/usr/bin/perl

use CGI ;
use Net::Telnet ();
my $passwd = "network" ;
$t = new Net::Telnet (Timeout => 2);
$t->open("192.168.1.1");
$t -> waitfor ('/Enter password: /');
$t -> print ('network') ;
$t -> waitfor ('/Enter Selection: /') ;
$t -> put ('V') ;
$t -> waitfor ('/Enter Selection: /') ;
$t -> put ('C') ;
$t -> waitfor ('/Select \[1 \- 4\]: /') ;
$t -> print ('1') ;
$t -> waitfor ('/Enter Selection: /') ;
$t -> put ('M') ;
$t -> waitfor ('/Enter port numbers: /') ;
$t -> print ('1-16') ;
$t -> close ;
exit(0);

Thanks in advance,
vivekian

Re: Problem Creating Socket : Permission Denied

am 22.08.2007 22:04:25 von Martijn Lievaart

On Mon, 20 Aug 2007 15:23:27 +0000, vivekian wrote:

> Hi,
>
> I have a cgi script which opens a telnet session to a switch. The script
> is listed below. It executes fine on command line. When i call it via a
> web browser, the error log shows the following error :
>
> problem creating socket: Permission denied at /var/www/html/vlab/cgi-
> bin/init_lab.cgi line 10
>
> Other scripts which don't have sockets execute fine.

Just a guess, but could it be selinux that gets in the way?

M4