Problem Creating Socket : Permission Denied

Discussion in 'Perl Misc' started by vivekian, Aug 20, 2007.

  1. vivekian

    vivekian Guest

    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
     
    vivekian, Aug 20, 2007
    #1
    1. Advertising

  2. 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
     
    Martijn Lievaart, Aug 22, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?Q2hyaXN0b2ZmZXIgU8O4cmVuc2Vu?=

    Permission denied creating directory

    =?Utf-8?B?Q2hyaXN0b2ZmZXIgU8O4cmVuc2Vu?=, Jun 21, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    1,021
    =?Utf-8?B?Q2hyaXN0b2ZmZXIgU8O4cmVuc2Vu?=
    Jun 22, 2004
  2. Laszlo Nagy
    Replies:
    1
    Views:
    4,874
    Mark Wooding
    Jan 27, 2009
  3. W. eWatson

    Socket Error: Permission Denied

    W. eWatson, Feb 9, 2010, in forum: Python
    Replies:
    3
    Views:
    1,333
    W. eWatson
    Feb 9, 2010
  4. Tony Proctor
    Replies:
    9
    Views:
    176
    Tony Proctor
    Oct 20, 2007
  5. Snail
    Replies:
    0
    Views:
    307
    Snail
    Mar 9, 2005
Loading...

Share This Page