tibberous Posted July 9, 2009 Share Posted July 9, 2009 I need to make a web interface that is able to change the permissions on files owned by root; This means being able to run the chmod command as root. Is there a way to do this? It seems like anything I start from the website is ran as apache. I tried to make a perl file, set the permissions to 7775 and start it from PHP but it didn't do anything -- not sure I did it right. Any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/165365-need-to-run-command-as-root-without-sudo-or-cron/ Share on other sites More sharing options...
JonnoTheDev Posted July 9, 2009 Share Posted July 9, 2009 If that were possible the security risks would be unbelievable. You could destroy a server. Quote Link to comment https://forums.phpfreaks.com/topic/165365-need-to-run-command-as-root-without-sudo-or-cron/#findComment-872084 Share on other sites More sharing options...
tibberous Posted July 9, 2009 Author Share Posted July 9, 2009 It would still require the attacker being able to write to PHP and Perl files on the server - at that point your pretty well screwed anyway. This isn't a shared server either, so its not like bad neighbor attacks are a concern. Quote Link to comment https://forums.phpfreaks.com/topic/165365-need-to-run-command-as-root-without-sudo-or-cron/#findComment-872090 Share on other sites More sharing options...
JonnoTheDev Posted July 9, 2009 Share Posted July 9, 2009 It would still require the attacker being able to write to PHP and Perl files on the server No, if the apache user had root permissions and you had a script that modifys files then it could be possible to inject code. Anyhow this question is probably better posted in the linux forum as it is not php specific. Quote Link to comment https://forums.phpfreaks.com/topic/165365-need-to-run-command-as-root-without-sudo-or-cron/#findComment-872095 Share on other sites More sharing options...
tibberous Posted July 9, 2009 Author Share Posted July 9, 2009 I think it is PHP doing something though. If I run this: php /var/www/vhosts/site.com/httpdocs/test.php It prints out what it should. If I go to site.com/test.php, it doesn't work - doesn't print anything at all. Quote Link to comment https://forums.phpfreaks.com/topic/165365-need-to-run-command-as-root-without-sudo-or-cron/#findComment-872098 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.