PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Wed Jul 15, 2020 10:19 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Fri Jun 26, 2009 1:38 am 
Offline
Forum Newbie

Joined: Thu Jun 25, 2009 10:05 am
Posts: 2
Hi,
I am new to php and web development. I wanted to run a system command from php script. I am using shell_exec() to run the command, but i need root privileges to execute it. I dont want to make 'Apache' a 'sudo user' nor do I want to change the default 'apache user' to root.

Please can someone suggest me a way in which I will be able to execute the command with root privileges.

Thanks in Advance,
Amul


Top
 Profile  
 
PostPosted: Fri Jun 26, 2009 1:49 am 
Offline
DevNet Master
User avatar

Joined: Wed Jun 27, 2007 9:44 am
Posts: 4313
Location: Sofia, Bulgaria

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


Top
 Profile  
 
PostPosted: Fri Jun 26, 2009 2:35 am 
Offline
Forum Newbie

Joined: Thu Jun 25, 2009 10:05 am
Posts: 2
Hi,

Thanks for your reply.
The command actually is my executable in which I am calling 'mkdir' and some other file handling commands. I have been trying to setuid for the script and the executable but it didnt seem to work.
I have found a solution to the problem though. I am writing a wrapper to my executable which is owned by a sudo user. In this wrapper I am calling the executable with a sudo in it. It seems to be doing the job. :)

Thanks
Amul


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

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 3 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:  
cron
Powered by phpBB® Forum Software © phpBB Group