From: "richard n. frank" <rnfrank () wolfram ! llnl ! gov>
To: tru64-unix-managers
Subject: Summary: C program to execute system calls
Date: Wed, 02 Dec 1998 22:57:25 +0000 [thread overview]
Message-ID: <96078731111716.tru64-unix-managers.marc@archive.invalid> (raw)
Greetings all,
I have been trying to get a C program to do things like mount
and umount cd's. In desperation I gave up trying to make other
people's programs work and set out on my own. It was pretty
easy after all. You can make this little program do anything you want
by changing the command inside the quotes in this line:
char *command = ("enter any unix command");
This is the C program to shutdown the system in 1 minute
/*
* shutdown.c 2. dec. 1998 rnf shutdown the system
*
*/
#include <stdlib.h>
#include <unistd.h>
main()
{
char *command = ("shutdown -h +1");
setuid(0);
system(command);
}
compile by : cc shutdown.c
then : mv a.out shutdown
then as root : chown root shutdown
chmod 755 shutdown
chmod u+s shutdown
cp shutdown /usr/bin
I believe this should be immune to the pervasive buffer
overflow problems because there is no input. I hope
somebody finds it useful.
rich frank
rnfrank@llnl.gov
reply other threads:[~1998-12-02 22:57 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox