From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <96078731111716.tru64-unix-managers.marc@archive.invalid> From: "richard n. frank" Date: Wed, 02 Dec 1998 22:57:25 +0000 To: tru64-unix-managers Subject: Summary: C program to execute system calls X-MARC-Message: https://marc.info/?l=tru64-unix-managers&m=96078731111716 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 #include 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