PDA

View Full Version : ifconfig problem


mbkarmakar2004
06-23-2007, 02:54 PM
When I run the following program in my web browser in linux....


----------------------------------------------------------------
#!/usr/bin/perl -w
#use uni-ifconfig.pl;
# The unified ifconfig command.
# Works the same way on FreeBSD, OpenBSD, Solaris, Linux, OS X, WinNT (from Win2K).
# Note: due of Net::Ifconfig::Wrapper limitations 'inet' and 'down' commands
# are not working on WinNT. +/-alias are working, of course.

use CGI;
use CGI::Carp qw(fatalsToBrowser warningsToBrowser);

use Net::Ifconfig::Wrapper;
use warnings;
$cgi=new CGI();
warningsToBrowser(1);
print $cgi->header();

my $Usage = << 'EndOfText';
uni-ifconfig.pl
uni-ifconfig.pl -a
uni-ifconfig.pl eth0
uni-ifconfig.pl eth0 down
EndOfText
my $Info = Net::Ifconfig::Wrapper::Ifconfig('up', 'eth0', '192.168.148.115', '255.255.255.0') or die $@;

#my $Info1 = Net::Ifconfig::Wrapper::Ifconfig('down', 'eth0', '192.168.148.112', '255.255.255.0') or die $@;
#my $Info3 = Net::Ifconfig::Wrapper::Ifconfig('up', 'eth0', '192.168.148.112', '255.255.255.0') or die $@;

-----------------------------------------------------------------

I am getting the following error:--

Software error:

Command '/sbin/ifconfig -a 2>&1', exit code '256'No usable address families found.
socket: Permission denied


Can anyone say my fault in the program or anywhere???

or can i do those functions (ifconfig eth0 192.168.148.1 up or iwconfig eth1 essid sddmin mode managed) in any other way??

modules i have installed in my computer
1. Net-Ifconfig-Wrapper-0.09.tar
2.Net-Interface-0.08.tar
3.Wifi-0.01a.tar

FishMonger
06-23-2007, 05:20 PM
Do you get the same error when executed from the command line instead of via the browser?

mbkarmakar2004
06-25-2007, 03:51 PM
Do you get the same error when executed from the command line instead of via the browser?


1.I am getting the following error:--

Software error:

Command '/sbin/ifconfig -a 2>&1', exit code '256'No usable address families found.
socket: Permission denied

2. when we have executed from the command line instead of via the browser machine ip will change successfully.please help me.


#!/usr/bin/perl -w
#use uni-ifconfig.pl;
# The unified ifconfig command.
# Works the same way on FreeBSD, OpenBSD, Solaris, Linux, OS X, WinNT (from Win2K).
# Note: due of Net::Ifconfig::Wrapper limitations 'inet' and 'down' commands
# are not working on WinNT. +/-alias are working, of course.

use CGI;
use CGI::Carp qw(fatalsToBrowser warningsToBrowser);

use Net::Ifconfig::Wrapper;
use warnings;
$cgi=new CGI();
warningsToBrowser(1);
print $cgi->header();

my $Usage = << 'EndOfText';
uni-ifconfig.pl
uni-ifconfig.pl -a
uni-ifconfig.pl eth0
uni-ifconfig.pl eth0 down
EndOfText
my $Info = Net::Ifconfig::Wrapper::Ifconfig('up', 'eth0', '192.168.148.115', '255.255.255.0') or die $@;

1.I am getting the following error:--

Software error:

Command '/sbin/ifconfig -a 2>&1', exit code '256'No usable address families found.
socket: Permission denied

2. when we have executed from the command line instead of via the browser machine ip will change successfully.
please help me.

Milan

FishMonger
06-25-2007, 04:12 PM
Did you give the web server user account proper rights to run the command? Normally, only root has rights to change the IP config of an interface. Normal users can only view, not change the settings.