PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Sun Sep 15, 2019 3:34 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Thu Aug 26, 2010 7:18 pm 
Offline
Forum Contributor

Joined: Fri Feb 05, 2010 8:15 pm
Posts: 101
Hi,


Please suggest some tasks of an administrative level that we can use PHP and call other Scripts to automate them.

It's a kind of homework for me to figure out how to automate those tasks. Your useful suggestions are most welcomed.

This would help me face interviews more effectively when they present such scenerios. For example, recenlt I was asked this question in an interview:

Using PHP and Shell Script design and develop a Web Interface to change or set the IP Address and Subnet Mask of the UNIX / Linux System. The related services must be restarted automatically for the new IP Address and Subnet Mask to take effect. No user name and password should be asked for when using that Web Interface. How would you do it?


One more thing, how do we make sure that a particular script (PHP, Shell Script, Perl, etc.) that contains administrative commands, which only the root user can issue, will work fine when such a script is called / accessed by non-priveleged users?

For example, we have a Shell Script (let's name it emptyTmp.sh) that empties /tmp directory. Now we want every user to run that script so that a non-priveleged user would not need any root priveleges to achieve this task. How do we go about it?

We can place a script in a directory such as /usr/bin and /bin for every one to access a script. But the commands that require root priveleges and have been written in scripts would work without any permission issue?

Thanks!


Top
 Profile  
 
PostPosted: Fri Aug 27, 2010 2:59 am 
Offline
DevNet Master
User avatar

Joined: Wed Jun 27, 2007 9:44 am
Posts: 4313
Location: Sofia, Bulgaria
man sudo
;)

Syntax: [ Download ] [ Hide ]
system('sudo ifconfig');

_________________
There are 10 types of people in this world, those who understand binary and those who don't


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group