Thursday, May 02, 2019

Re: User who invoke doas

On 5/1/19 10:28 PM, Adam Steen wrote:
> Hi
>
> 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?

So ...

$ whoami
nick

$ doas -s

# whoami
root

# env |grep nick
LOGNAME=nick
HOME=/home/nick
MAIL=/var/mail/nick

PATH=/home/nick/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R/bin:/usr/local/bin:/usr/local/sbin:/usr/games:.
USER=nick

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

'dar ya go.

Nick.

No comments:

Post a Comment