RE: printing output of ping command -- New question at bottom.

From: Tyson Sommer (tysons_at_firstcash.com)
Date: 02/24/05


To: "'Perl Beginners List'" <beginners@perl.org>
Date: Thu, 24 Feb 2005 08:56:17 -0600


 

> -----Original Message-----
> From: John W. Krahn [mailto:krahnj@telus.net]
> Sent: Wednesday, February 23, 2005 2:50 PM
> To: Perl Beginners
> Subject: Re: printing output of ping command -- New question
> at bottom.
>
> Tyson Sommer wrote:
> >
> > This might be a question for beginners-cgi, but since it
> was mentioned
> > here...
> >
> > I tried to use Net::Ping in a CGI script and it said I didn't have
> > permissions to run ping. I can execute the section of the
> CGI script with
> > the call to Net::Ping just fine from the cmd line as a
> regular user. If I
> > use backticks instead, the script runs just fine via the CGI. Any
> > suggestions? I'm still somewhat novice on a *nix box, so I
> don't know what
> > to change to allow ping to be run from Net::Ping via the
> CGI interface (via
> > Apache).
> >
> > Assume warnings, strictures, and that a new CGI has been
> called (everything
> > else in the script works fine), blah, blah:
> >
> > my $pinger = Net::Ping->new("icmp") || die;
> > my $device = $q->param('device');
> >
> > if( $pinger->ping($host,2) ){
> > print "$host is online\n";
> > }
> > else{
> > print "$host is offline\n";
> > }
> >
> > This gets me an error in my browser saying I don't have
> permission to run
> > ping (yes, using CGI::Carp... As well for troubleshooting).
>
>
> perldoc Net::Ping
> [snip]
> If the "icmp" protocol is specified, the ping()
> method sends an icmp
> echo message to the remote host, which is what the
> UNIX ping program
> does. If the echoed message is received from the
> remote host and the
> echoed information is correct, the remote host is
> considered reachable.
> Specifying the "icmp" protocol requires that the
> program be run as root
> or that the program be setuid to root.
>
>
> Your web server does not run as root so you have to use
> either TCP or UDP
> instead of ICMP.

That worked.

Note to self: RTFM...B (Better)

Thanks,
Tyson



Relevant Pages

  • Re: The specified network name is nolonger available
    ... If you can ping by name ping computer2 and it ... But mapping drives with IP address means that I cannot use DHCP. ... : abour w2kPro, not Server ... I am very much confused about sharing permissions. ...
    (microsoft.public.win2000.networking)
  • Re: unable to write from a select into outfile
    ... You don't have create/write permissions to the /tmp directory on your ... remote host as whatever user your remote host's CGI is running as. ... including the "nobody" user and the database and web server accounts. ...
    (perl.dbi.users)
  • CGI Security, File Permissions and FUD
    ... I am planning to use CGI for my web installations and there appears to ... What are the permissions actually required for reading and writing ... into the web users directory? ... Unless a file is to be served directly by the web server process and ...
    (comp.infosystems.www.servers.unix)
  • Re: Help on connectivity issue and permissions
    ... The permissions I changed were on the user accounts. ... >> When I Ping from the outside, ... >> can see the NIC received activity increment when I ping ... >network card? ...
    (microsoft.public.windows.server.sbs)
  • Re: printing output of ping command -- New question at bottom.
    ... > permissions to run ping. ... the script runs just fine via the CGI. ... > else in the script works fine), blah, blah: ...
    (perl.beginners)