PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPHP Development
The ASP Free website provides in-depth information on the latest developer tools available from Microsoft. Our cadre of writers, highly experienced industry experts, reveals the best ways to use established technologies as well as new and emerging technologies. Our coverage of Microsoft's development and administration technologies is among the most respected in the IT industry today.

ASP Free and Iron Speed Designer are giving away $5,500+ in FREE licenses. Iron Speed's RAD CASE toolset can save up to 80% of your coding time. One free license per week, one perpetual license per month!
Download and Activate to enter!

Intel® Graphics Performance Analyzers is a powerful tool suite for analyzing and optimizing your games, media, and graphics-intensive applications. Used by some of the best developers on the planet, Intel GPA lets you maximize your app’s performance.


Tutorials
| Forums

Download to Enter
| Contest Rules

DOWNLOAD INTEL® GPA FOR FREE

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 19th, 2006, 02:52 PM
dude4453169 dude4453169 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2005
Posts: 73 dude4453169 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 21 h 2 m 2 sec
Reputation Power: 7
Problem in using sudo

I'm trying to setup sudo in my php script I need to execute a process to perform some processing. in my /etc/sudoer file I currently have the line (I used "visudo" to edit it)

nobody ALL = NOPASSWD : /root/test/processreq

and in my php script I have

exec("sudo /root/test/processreq $param1 $param2");


However when I run the script it doesn't run the processing request. Is there something else I'm missing here? Also, do I need to reboot the linux box after I do visudo for it to take effect?

Reply With Quote
  #2  
Old October 19th, 2006, 03:03 PM
conrad10781 conrad10781 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2005
Location: New York
Posts: 153 conrad10781 User rank is Sergeant Major (2000 - 5000 Reputation Level)conrad10781 User rank is Sergeant Major (2000 - 5000 Reputation Level)conrad10781 User rank is Sergeant Major (2000 - 5000 Reputation Level)conrad10781 User rank is Sergeant Major (2000 - 5000 Reputation Level)conrad10781 User rank is Sergeant Major (2000 - 5000 Reputation Level)conrad10781 User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Day 2 h 47 m 41 sec
Reputation Power: 32
Send a message via ICQ to conrad10781
No you don't need to restart it.. But your problem is probably one of a few things (though none of them are php issues)..

1. Your machine is probably waiting for a user input for the sudo password (unless you set it so the user doesn't have to supply one)

2. You may be better off running a .sh to execute that if #1 is the case

There are a few others, but I figure we should start with those obvious ones

Reply With Quote
  #3  
Old October 19th, 2006, 03:14 PM
l09f1l3's Avatar
l09f1l3 l09f1l3 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2006
Location: South Africa
Posts: 117 l09f1l3 User rank is Sergeant (500 - 2000 Reputation Level)l09f1l3 User rank is Sergeant (500 - 2000 Reputation Level)l09f1l3 User rank is Sergeant (500 - 2000 Reputation Level)l09f1l3 User rank is Sergeant (500 - 2000 Reputation Level)l09f1l3 User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 1 Day 18 h 53 m 58 sec
Reputation Power: 14
Or as a quick hacklike fix, you can enable the root account. However, this causes issues around security.

Then again, I tend to agree with the idea that it is waiting for the password. Try the shell script, that might just work without causing too much security issues.

Reply With Quote
  #4  
Old October 19th, 2006, 03:31 PM
dude4453169 dude4453169 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2005
Posts: 73 dude4453169 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 21 h 2 m 2 sec
Reputation Power: 7
thanks is there any good example how do I do this with shell script and supply the parameter from php? sorry I'm new with linux


Quote:
Originally Posted by conrad10781
No you don't need to restart it.. But your problem is probably one of a few things (though none of them are php issues)..

1. Your machine is probably waiting for a user input for the sudo password (unless you set it so the user doesn't have to supply one)

2. You may be better off running a .sh to execute that if #1 is the case

There are a few others, but I figure we should start with those obvious ones

Reply With Quote
  #5  
Old October 19th, 2006, 03:39 PM
l09f1l3's Avatar
l09f1l3 l09f1l3 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2006
Location: South Africa
Posts: 117 l09f1l3 User rank is Sergeant (500 - 2000 Reputation Level)l09f1l3 User rank is Sergeant (500 - 2000 Reputation Level)l09f1l3 User rank is Sergeant (500 - 2000 Reputation Level)l09f1l3 User rank is Sergeant (500 - 2000 Reputation Level)l09f1l3 User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 1 Day 18 h 53 m 58 sec
Reputation Power: 14
Well, I found this site

and this one

But it still feels like you are setting yourself up to get hacked. Is this PHP script coming from the command line or on your web server? If it is from the web, perhaps you need to work on some creative CRON job running as a priviledged user.

Also, search the ubuntu forums, there you can find a way to enable the root account so you can make a script run as root, but once again, you could be setting yourself up for a seriously bad day by running a script that requires root privileges from PHP, can you perhaps tell us what exactly you are trying to do?

Reply With Quote
  #6  
Old October 20th, 2006, 11:47 AM
dude4453169 dude4453169 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2005
Posts: 73 dude4453169 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 21 h 2 m 2 sec
Reputation Power: 7
If my linux box is setup as SELinux, will I still be able to do this?

Oh btw to get back to your question php script will be run as web server, it will submit a request for the user by running the executable in the background. the executable has only limited things that it can do and cannot take input from the user directly.



Quote:
Originally Posted by l09f1l3
Well, I found this site

and this one

But it still feels like you are setting yourself up to get hacked. Is this PHP script coming from the command line or on your web server? If it is from the web, perhaps you need to work on some creative CRON job running as a priviledged user.

Also, search the ubuntu forums, there you can find a way to enable the root account so you can make a script run as root, but once again, you could be setting yourself up for a seriously bad day by running a script that requires root privileges from PHP, can you perhaps tell us what exactly you are trying to do?

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > Problem in using sudo


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.

© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 9 - Follow our Sitemap