Timeline for How to make `sudo` preserve $PATH?
Current License: CC BY-SA 4.0
7 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jul 12, 2023 at 15:30 | comment | added | keithpjolley |
I don't know that it's the best answer. It's a good answer. The reason why is some scripts start with something like #!/usr/bin/env python3 and this answer won't help make sure you get the right python3, like for a virtual environment.
|
|
| Oct 11, 2022 at 7:07 | comment | added | Kevin Chan | using absolute path avoid PATH problem. in general purpose a smart move | |
| Jan 18, 2022 at 9:16 | comment | added | SebMa |
@DaveMorse Yes, in that sense, my example is not secure but then the question of How to make "sudo" preserve $PATH? is not a secure idea either.
|
|
| Jan 18, 2022 at 4:11 | comment | added | Dave Morse | Unless the command you're using calls other commands that it expects to find in $PATH - then you want to be "hijacked", and so the other answers are better. | |
| Jan 14, 2021 at 14:08 | comment | added | Jim Hunziker | This is the best answer because it doesn't expose you to other commands on your path being hijacked. All of the other answers here risk running other executables as root. | |
| May 28, 2018 at 13:36 | history | edited | SebMa | CC BY-SA 4.0 |
added 166 characters in body
|
| May 28, 2018 at 13:25 | history | answered | SebMa | CC BY-SA 4.0 |