SUMMARY:How to make a C program run as root.

From: Peter Tashkoff (TASHKOP@kiwi.co.nz)
Date: Tue Feb 18 1997 - 18:01:14 CST


The answer is :

1. "chown root filename", then "chmod 4755
filename".
If like me, this doesn't work for you then the
chances are the filesystem has been mounted
with -nosuid. (as mine is)

In this case you can ;

2. Include the following in the code.
#include <stdio.h>
.....
 setuid(geteuid());

This works even with the disks mounted -nosuid.

For providing me with the answers and
clearing up my ignorance on terminology
Thank you very much to
Jafar Shameem
<jafar@finance.capital.ge.com>
Russ Poffenberger
<poffen@San-Jose.ate.slb.com>
Frank Pardo <fpardo@tisny.com>
Reto Lichtensteiger <rali@meitca.com>
Eduardo E. Silva <esilva@netcom.com>
Rich Snyder <rsnyder@eos.hitc.com>
Donn MacCara
<dmaccara@bank-banque-canada.ca>
Mark Belanger <mjb@ltx.com>
Matthew Stier <Matthew.Stier@MCI.Com>
Rich Casto <rc@surreal.org>

and anyone else whose mail hasn't arrived yet.

Your assistance is most appreciated.

regards
peter tashkoff



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:11:46 CDT