Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Jul 2007 10:10:33 -0500
From:      Brooks Davis <brooks@freebsd.org>
To:        Ben Kaduk <minimarmot@gmail.com>
Cc:        Darren Pilgrim <freebsd@bitfreak.org>, dmw@unete.cl, FreeBSD Hackers <freebsd-hackers@freebsd.org>
Subject:   Re: A few questions...
Message-ID:  <20070724151033.GA19358@lor.one-eyed-alien.net>
In-Reply-To: <47d0403c0707232237t272f4e7exb0f55c21bbd097c7@mail.gmail.com>
References:  <200707232052.58485.dmw@unete.cl> <46A577BB.5020400@bitfreak.org> <47d0403c0707232237t272f4e7exb0f55c21bbd097c7@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--oyUTqETQ0mS9luUI
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Tue, Jul 24, 2007 at 12:37:53AM -0500, Ben Kaduk wrote:
>  On 7/23/07, Darren Pilgrim <freebsd@bitfreak.org> 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 =3D=3D 0 is the common practice for
> > determining if the effective UID has root priveleges.
>=20
>  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

--oyUTqETQ0mS9luUI
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (FreeBSD)

iD8DBQFGphZpXY6L6fI4GtQRAoZHAJ9n47/ixv0cfA8LRZO2J9k1ENSHpwCeObT8
Q0pN+Xi90Fwf8BH+9mkudpo=
=Yane
-----END PGP SIGNATURE-----

--oyUTqETQ0mS9luUI--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070724151033.GA19358>