Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 07 Feb 2005 10:30:30 -0800
From:      Tabor Kelly <tkelly-freebsd-questions@taborandtashell.net>
To:        Lowell Gilbert <freebsd-questions-local@be-well.ilk.org>
Cc:        FreeBSD Questions <freebsd-questions@freebsd.org>
Subject:   Re: Very general shutdown question
Message-ID:  <4207B3C6.7000002@taborandtashell.net>
In-Reply-To: <44zmygtgt7.fsf@be-well.ilk.org>
References:  <200502061646.27199.nedsmailbox2@cox.net> <4206E19B.6050503@taborandtashell.net>	<44oeewwj4r.fsf@be-well.ilk.org> <4207A3DF.10301@taborandtashell.net> <44zmygtgt7.fsf@be-well.ilk.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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@taborandtashell.net
http://tabor.taborandtashell.net



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4207B3C6.7000002>