On Oct 30 2007 17:13, Stefan Hundhammer wrote: >On Tuesday 30 October 2007 14:14, David C. Rankin J.D. P.E. wrote: >> Listmates, >> >> In a script, I need to test that the user is either root or has su'ed >> to root before continuing. The USER in the environment remains the >> original user and there is nothing set related to 'su'. Any thoughts? > >A bit more obvious (but starting an external program) than checking >$UID for 0: > > whoami > >This uses the effective (!) user ID, i.e. it also returns "root" for "su" >or "sudo".
There is no guarantee that "root" or UID 0 actually have the privilege to do this or that. Think Linux Security Modules (LSM).. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]