LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-26-2008, 06:57 AM   #16
av.dubey
Member
 
Registered: Nov 2007
Posts: 148

Original Poster
Rep: Reputation: 15

see i want to make a php code that my frnds will use ..eveyone is having his owrn linux laptop with fedora installedd on it...
i make a webmaster.php file that ill be giving to everyone so that they can paste the same on their respective linux laptop and use it for trial purpose..
now suppose i gave to code to my frnd named xyz ...then he simply needs to copy that code in his cgi-bin folder and run http://localhost/cgi-bin/webmaster.php ...so a page will open that will ask him his root password...after giving the root password a username and password will be asked for from the user ....after providing it..a user will automatically be added in his system...thats it...

so i don think there makin apache as sudouser in each and every laptop will be a good idea ...cause as such users are ready to provide their root password...
 
Old 06-26-2008, 10:52 AM   #17
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,396
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
Thanks for clearing that up. Since there is no way to feed su a password as a commandline argument, you will have to use some method to feed it a password string as a response to it's prompt. The classical method of doing this is with expect, which is a tool used to anticipate (expect) prompts and other standard output from commands, and to supply input to those commands. You would have to launch, from your PHP script (I'd use Perl here, but that's just me), an expect script which has been contrived to supply the password to su -c at the proper time. A huge hack, IMHO.
An even huger (did I just create a new word?) hack can be contrived using GNU screen, and exploiting its ability to stuff keystrokes/strings into it's console stream. There's an adventure for you.
The sudo/visudo combination seems a lot cleaner to me. It uses a system that was created specifically for the kind of purpose you are using. If your buddies can't follow a simple recipe to get the 'apache' user into the sudoers file, are they ready to be administrators of a system? Doesn't their system already have a GUI tool for administration of users and groups?
As a purely academic exercise, there is much to be learned by doing all of this, and on that level it seems like a worthwhile endeavor. As a practical approach to solving a problem, it doesn't.
--- rod.

Last edited by theNbomr; 06-26-2008 at 10:55 AM.
 
Old 06-26-2008, 01:10 PM   #18
av.dubey
Member
 
Registered: Nov 2007
Posts: 148

Original Poster
Rep: Reputation: 15
thanks a lot man...ya its not for some practical reason or solution ...but actually i wanted to make a small webmin sort of thing....cause it also does the same thing as far as i know...people just install webmin on their respective linux machines and are able to do all the stuff graphically through web..
it also uses php i think...den how does it do it....?????
 
Old 06-26-2008, 05:28 PM   #19
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,396
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
Well, if it is open source, you should be able to look and see. When you do, why don't you report back here and let us all know?
My hunch is that while it may use PHP in some way, it is probably a compiled binary application that also has a built in HTTP server, thereby making use of any web browser as its UI. There are other applications that do the same thing, especially embedded systems which don't otherwise have any real user interface. It is a good fit as a system admin tool, since many servers are set up to run headless, and don't have a console at which a sys admin can sit down and work.

--- rod.
 
Old 06-27-2008, 02:10 PM   #20
av.dubey
Member
 
Registered: Nov 2007
Posts: 148

Original Poster
Rep: Reputation: 15
@din get u wat u want to say..

i din get clearly wat u want to say...actually m also planning to make a thing jst like webmin...whichn ll give linux users a graphical interface to do almost all the jobs..but for that m not able to login as root user using php...this is my main problem..once m able to login as root user in linux machin using php or even perl (in web using .cgi)...my rest of the code is almost ready..


so plzz can neone tell me how to login as root user in linux using php so that i can use system or exec commands to do whatever i want to do..ie use all the shell commands n all...till now m able to run only normal user commands using php as m unable to login as root user using php...
 
  


Reply


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
helping in cgi script that add users to the system adam_blackice Programming 14 04-16-2007 03:41 AM
run cgi script as a user other than apache paul_mat Linux - Software 1 06-02-2006 03:01 PM
trying to add cgi-bin perl script. shizzle Linux - Networking 7 05-19-2005 02:24 AM
Allow user to run their own cgi script samwong Linux - Newbie 5 05-25-2004 11:22 PM
CGI Script add user to redhat 9 djkoe Linux - General 1 02-08-2004 05:20 PM


All times are GMT -5. The time now is 04:15 PM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration