Re: start / run a program only when logged in as root
- From: Sean Thomas Middleditch <sean middleditch iname com>
- To: Adam Sleight <adams linearcorp com>, gnome-devel-list gnome org
- Subject: Re: start / run a program only when logged in as root
- Date: Wed, 24 May 2000 19:51:29 -0400
Adam Sleight wrote:
> linuxconf will not start if your not logged in as root.
> same with rpm won't run without being root.
>
> What is involved (details) of how to require the program to be executed only as
> root. Currently this program runs under any user but that is not ideal since
> it'll probably screw it up.
Check the user ID (getuid () or something like that, check the man pages) and see
if it is 0 (which is root's UID). Also, you could setup PAM files so that when
you run the program, PAM will ask for root password and run the program as root,
which is cool, is makes it a LOT easier to people too lazy (or too much of
computer novices) to open up a terminal, run su, then the command. GUI's are
fun. ^,^
Anyways, something like, in pseudo code
if getuid () != 0 then
nonRootErrorFunctionThingyButPleaseUseAShorterName ()
endif
Wow. That's the first time I ever wrote pseudo-code. I don't think I like it.
~,^
Sean Middleditch
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]