Execute an unix root script
Moderator: General Moderators
Execute an unix root script
Hi.
I've a site under PHP and UNIX and I need to run a script witch the owner is the root. How can I pass from php to the OS the necessary data (root username and password) to run the script as root?
Tks...
I've a site under PHP and UNIX and I need to run a script witch the owner is the root. How can I pass from php to the OS the necessary data (root username and password) to run the script as root?
Tks...
- Ambush Commander
- DevNet Master
- Posts: 3698
- Joined: Mon Oct 25, 2004 9:29 pm
- Location: New Jersey, US
What does the script do that it needs to be run as root? It's almost NEVER a good idea to have something that can be run by root, be accessible via a webpage.
Look into sudo, it might give you the ability to execute that script as root, without needing root level access.
Look into sudo, it might give you the ability to execute that script as root, without needing root level access.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Agreed. Running scripts with root privileges from a web pagepickle wrote:What does the script do that it needs to be run as root? It's almost NEVER a good idea to have something that can be run by root, be accessible via a webpage.
Look into sudo, it might give you the ability to execute that script as root, without needing root level access.
On a side-note, although I'd have to suggest the same thing imho,
sudo + web script == disaster!
if your hosting it your self you might be able to get away with it. make root owner of the file then follow some of the other suggestions.
If you have the site hosted somewhere, good luck because any host worth their salt wouldn't even consider the idea of allowing a script to be run a root.
Otherwise I will agree with the man who spends his days in vinegar
If you have the site hosted somewhere, good luck because any host worth their salt wouldn't even consider the idea of allowing a script to be run a root.
Otherwise I will agree with the man who spends his days in vinegar
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
- Ambush Commander
- DevNet Master
- Posts: 3698
- Joined: Mon Oct 25, 2004 9:29 pm
- Location: New Jersey, US