Thursday, May 02, 2019

Re: User who invoke doas

Nick Holland wrote:
> > In a shell script invoked by doas, is it possible to find which user
> > invoke the script? my search a the moment has come up empty.
>
> most likely place would be an environment variable, right?

>
> # echo "I started out as $LOGNAME"
> I started out as nick

Note that LOGNAME and other variables can be set by the user to indicate a
different user name.

$ env LOGNAME=somebody doas sh -c 'echo $LOGNAME'
somebody

No comments:

Post a Comment