On Tue, Jul 24, 2007 at 12:37:53AM -0500, Ben Kaduk wrote:
>  On 7/23/07, Darren Pilgrim <[EMAIL PROTECTED]> wrote:
> > Daniel Molina Wegener wrote:
> > > Hello,
> > >
> > >    I need information about few things, I hope someone can help
> > > me and thanks in advance.
> > >
> > > a) Is there any function or variable that tells me which is the
> > >    root user UID in the system, or root always have 0 and it's
> > >    an "elegant" option to compare the variables or structure
> > >    members against zero.
> >
> > Root is always UID 0.  Checking UID == 0 is the common practice for
> > determining if the effective UID has root priveleges.
> 
>  But should it be common practice?  What of suser(9) and priv(9)?

In userspace it's what you have to do if you're going to check
privleges.  In general though, you shouldn't check at all and just
attempt the operation and let the kernel decide (there are of course
exceptions to this rule).  In the kernel you should use priv(9).

-- Brooks

Attachment: pgpokK2vdLPUj.pgp
Description: PGP signature

Reply via email to