Very general shutdown question

Tabor Kelly tkelly-freebsd-questions at taborandtashell.net
Mon Feb 7 10:30:34 PST 2005


Well thanks, too bad I was planning on using those to make my backup 
jobs easier. Anyway, here is a quick C program to accomplish the same 
thing:

/* main.c */
#include <unistd.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
extern char **environ;

execve("/sbin/halt", argv, environ);
return EXIT_SUCCESS; /* note: we never actually get here */
}

to compile it, but type 'gcc main.c'
then copy a.out to /halt
then 'chown root:wheel /halt'
then 'chmod a+s /halt'

But when I got done writing and testing the program, I thought to myself:
Why not just set /sbin/halt to SUID root?

-- 

Tabor Kelly
tkelly-freebsd-questions at taborandtashell.net
http://tabor.taborandtashell.net



More information about the freebsd-questions mailing list