[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: how to identify the superuser in C

Oohara Yuuma <oohara@libra.interq.or.jp> writes:

>> fakeroot (or any other dynamic linker tricks) will not work on set[ug]id
>> programs.  libc can be trusted here.
> Is this Linux specific?  (There can be a Hurd port in the sarge
> release).

Of course the same protection is present in GNU/Hurd.

  Btw: this problem (`how to find out your id[s]') is even trickier in
GNU/Hurd.  Let's have a look at how fakeroot is implemented in

  Instead of using a libfakeroot trick, we simply use our own features
for that, which can do much better.  Authentication in the Hurd is
based on the `auth' server.  Now, in the Hurd it is possible to use
other auth servers than the default system server.  Glibc functions
working with IDs in fact communicate with the auth server.

  If you use your own auth server, then getuid() returns whatever that
auth server tells you (of course, faking your auth server does not
raise your permissions in the system at all, since that auth server is
private to you).

  Now, back to fakeroot.  Fakeroot in GNU/Hurd consists of:

  * a command line program (fakeauth), which creates a new auth server
    and runs a program with the auth server changed accordingly.  This
    makes getuid() and friends behave like if the program would run as

  * a filesystem server, which is used for faking filesystem accesses
    - this makes chmod/chown work accordingly.

moritz@duesseldorf.ccc.de - http://duesseldorf.ccc.de/~moritz/
GPG fingerprint = 3A14 3923 15BE FD57 FC06  B501 0841 2D7B 6F98 4199

Reply to: