[sudo-users] Passing the uid sudo was run by

Michael Potter pottmi at gmail.com
Wed Dec 6 23:54:51 EST 2006


Minor correction...

On 12/6/06, Matthew Hannigan <mlh at zip.com.au> wrote:
>
> On Wed, Dec 06, 2006 at 03:28:16PM +1000, Paul Stepowski wrote:
> > Hi list,
> >
> > I was wondering if it's possible for a script to check which user sudo
> was run as.
>
> environment variable SUDO_USER


SUDO_USER would be the username.
SUDO_UID is the user id (number)

echo "original uid=$SUDO_UID($SUDO_USER)"

> e.g.
> >
> > paul at box$ sudo ./my_script
> > original uid=509(paul)
> >
> > Is there any way for ./myscript to know the original uid of the user who
> ran
> > sudo?
>
>
> >  If so, can this be done in such a way that the uid cannot be
> manipulated
> > by the user running "sudo ./myscript"?
>
> Yeah, but of course not if ./myscript is modifiable by that
> user!
>
> Matt
>
> ____________________________________________________________
> sudo-users mailing list <sudo-users at sudo.ws>
> For list information, options, or to unsubscribe, visit:
> http://www.sudo.ws/mailman/listinfo/sudo-users
>



More information about the sudo-users mailing list