nishanth ev am Dienstag, 14. Februar 2006 17.56: > hello Friends, > > Have anyone tried stopping a service say httpd usng a > cgi script ? > I have set a setuid for the cgi script and the script > is in the root cgi-bin directory namely > /var/www/cgi-bin/ with ownership root and have the > following contents in the file > > #!/usr/bin/perl > $ENV{'PATH'} = '/bin:/usr/bin'; > print"Content-type:text/html\n\n"; > `/etc/rc.d/init.d/httpd stop`; > > ./file-name.cgi will stop the httpd but i want to stop > the httpd when i access this cgi through the browser.
As Tom alredy pointed out, there are some security implications by enabling service starting and stopping through a web interface. In my persopnal opinion, it's better not to call a (set-id) program but just touch or modify a file if possible. You could set up a cron job to test modification time of the touched file and stopping/restarting the service accordingly (and, e.g., let it send a notification mail to you or any other recipient not provided by the webinterface user). In any case, be careful not to enable DOS-attacks. hth, Hans -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>