Run root command through web page
i am using linux as a web server,
i want to use a web page to run command as root such as netstat, useradd etc...
Linux
i am using linux as a web server,
i want to use a web page to run command as root such as netstat, useradd etc...
by andy
What web server are you using? Apache runs as wwwrun nogroup so only has access to the web root. If you give you server access to run as root you are opening the whole system up to be hacked.
The web page could create a parm file and you could havea CRON job pick up the data to process but again think about the security implications.
Apache does have the ability to SU with SUEXEC, http://httpd.apache.org/docs/suexec.html for details.
Andy
by horace2ung
I STRONGLY NOT RECOMMEND you to do such things!!! But if you still want...
Files on Linux's filesystem have SUID and SGID attributes. If they are set (by chmod command - see man chmod) and file is owned by root, it can be executed with root privileges by any user. There is one exception: it MUST be not the shell script - on kernel level shell scripts are not allowed to be SUID. All ok with Perl. But BE VERY CAREFUL (!!!), SUID programs are possible security hole.
If you still want to do what you want...
Create something like CGI Perl script which will run needed command with correct parameters (probably specified in arguments of CGI script), place it in CGI directory of your HTTP-server and make it SUID. Then write web-interface to it and enjoy :)
HTH
Eugen
by horace2ung
by greg
If you really want to do it, and you have PHP installed, you can use the following script:
http://www.gimpster.com/php/phpshell/index.php
N'Joi!
by horace2ung
you should check out www.webmin.com it has
most if not all of what you need
by horace2ung
by horace2ung
This discussion is closed to new replies.
Sort by Trending