[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: setting path for root after "sudo su" and "sudo" for Debian Bullseye (11)



On Sat, May 21, 2022 at 06:04:07PM +0200, Linux-Fan wrote:
> Greg Wooledge writes:
> 
> > On Sat, May 21, 2022 at 10:04:01AM -0500, Tom Browder wrote:
> > > I am getting nowhere fast.
> > 
> > OK, let's start at the beginning.
> > 
> > You have raku installed in some directory that is not in a regular PATH.
> > 
> > You won't tell us what this directory is, so let's pretend it's
> > /opt/raku/bin/raku.
> 
> [...]
> 
> > The voices in your head will tell you that you absolutely must use
> > sudo to perform your privilege elevation.
> > 
> > Therefore the third solution for you: configure sudo so that it does
> > what you want.
> > 
> > Next, of course, the voices in your head will tell you that configuring
> > sudo is not permissible.  You have to do this in... gods, I don't know...
> 
> [...]
> 
> There is also `sudo -E` to preserve environment and
> `sudo --preserve-env=PATH` that could be used to probably achieve the
> behaviour of interest.

Exactly. The man page tells us (hint, hint ;-)

-E doesn't preserve PATH on my system, but --preserve-env=PATH does.

This surely has to do with the "security policy" mentioned in the
man page (passing PATH to a root shell is a wonderful opportunity
for a root privilege escalation, after all, so it makes sense to
not establish it as a default).

I'm sure the OP is now able to locate that "security policy" config
and change it to taste. "--preserve-env=PATH" is quite a mouthful
and one doesn't want to type it all the time :-)

Cheers
-- 
t

Attachment: signature.asc
Description: PGP signature


Reply to: