[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)



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. If this is not permitted by security policy but arbitrary commands to run with sudo are, consider creating a startup script (or passing it directly at the `sudo` commandline) that sets the necessary environment for the raku program.

That being said: On my systems I mostly synchronize the bashrc of root and my regular users such that all share the same PATH. I tend to interactively become root and hence ensure that the scripts are run all of the time. This has mostly survived the mentioned change in `su` behaviour and observable variations between `sudo -s` and `su` behaviours are kept at a minimum.

HTH and YMMV
Linux-Fan

öö

Attachment: pgpGDYakmpD6X.pgp
Description: PGP signature


Reply to: