LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 08-05-2010, 08:30 AM   #1
Hi_This_is_Dev
Member
 
Registered: May 2009
Location: India
Distribution: On my PC I use RHEL, at office AIX, Solaris, HP-UX, RHEL.
Posts: 254

Rep: Reputation: 18
Automating Linux Administration through Web Interface


Hi,


The question that I am posting here is quite interesting as it was asked in the interview I attended today. And, honestly, I could not provide a solution.

Ok, here goes the problem statement:

Design a Web Interface that has three text fields:

IP Address:
Subnet Mask:
Default Gateway:


And a button:

Submit

When we click the Submit button, the two entries must be set in the concerned files and then the network service must be restarted to bring the new IP Address, Subnet Mask, and Default Gateway in effect.

As we all know that these settings can be done by the root user or a user who has those priveleges.

So, finally, how can we achieve it?

The complete web interface needs to be done only in PHP. Some Shell Script can be used if required.
 
Old 08-05-2010, 05:46 PM   #2
SciFi-Bob
Member
 
Registered: Aug 2008
Location: Denmark
Distribution: Debian/Ubuntu
Posts: 49

Rep: Reputation: 18
One method, is to make a shell (bash) script to do it, and put it in sudoers, so that the web service can execute it.

I have a few of these "root scripts" that works just fine.

An example on ubuntu, in /etc/sudoers:

www-data ALL=NOPASSWD: /www/scanfile.sh

This allows me to run "exec('/usr/bin/sudo /www/scanfile.sh')"
in PHP as root.
 
  


Reply

Tags
exec, php, sudo


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Intro to Automating System Administration with Cfengine 3 LXer Syndicated Linux News 0 06-08-2010 10:20 PM
Automating database web search Phyrexicaid Programming 6 04-09-2008 06:17 AM
linux system administration including network administration linux_linux Linux - Hardware 3 03-15-2008 10:07 PM
web interface contorl Linux leiw Linux - Newbie 2 12-24-2006 02:32 AM
CUPS web-administration interface on SuSE 9.1 LUB997 Linux - Hardware 1 03-09-2005 02:16 AM


All times are GMT -5. The time now is 11:08 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration