Re: doas id -ru returns 0 ?

2018-04-23 Thread Rudolf Sykora
On 23 April 2018 at 17:19, Philip Guenther  wrote:
> On Mon, Apr 23, 2018 at 4:53 PM, Rudolf Sykora 
> wrote:
>>
>> I expected that
>>
>> doas id -ru
>>
>> would return my uid.
>>
>> But it returns 0 (ie root)
>>
>> Can anybody comment on it?
>
>
> Hmm, what led you to expect it to return your UID?
>
> doas, like su, sets both the effective and real UID to the target user's;
> running something with doas is not the same as making it setuid and running
> it.  Running with effective!=real can trip up programs that didn't expect
> it, so it not a safe choice for something like doas.

Aha. Thanks for the explanation!
I thought it's more like setuid...
Sorry.

Ruda



Re: doas id -ru returns 0 ?

2018-04-23 Thread Philip Guenther
On Mon, Apr 23, 2018 at 4:53 PM, Rudolf Sykora 
wrote:

> I expected that
>
> doas id -ru
>
> would return my uid.
>
> But it returns 0 (ie root)
>
> Can anybody comment on it?
>

Hmm, what led you to expect it to return your UID?

doas, like su, sets both the effective and real UID to the target user's;
running something with doas is not the same as making it setuid and running
it.  Running with effective!=real can trip up programs that didn't expect
it, so it not a safe choice for something like doas.


Philip Guenther


doas id -ru returns 0 ?

2018-04-23 Thread Rudolf Sykora
Hello,

I expected that

doas id -ru

would return my uid.

But it returns 0 (ie root)

Can anybody comment on it?

Thanks
Ruda