[MacPorts] #70680: sudo @1.9.16 -- sudo: port: command not found
MacPorts
noreply at macports.org
Tue Sep 3 21:33:40 UTC 2024
#70680: sudo @1.9.16 -- sudo: port: command not found
---------------------+--------------------
Reporter: RobK88 | Owner: (none)
Type: defect | Status: new
Priority: Normal | Milestone:
Component: ports | Version: 2.10.1
Resolution: | Keywords:
Port: port |
---------------------+--------------------
Comment (by RobK88):
I found the bug in the `sudo` port!!
The default `/opt/local/etc/sudoers` file in the `sudo` port sets the
`secure_path` variable:
{{{
## Use a hard-coded PATH instead of the user's to find commands.
## This also helps prevent poorly written scripts from running
## artbitrary commands under sudo.
Defaults
secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
}}}
I recommend that the `sudo` port patch the `/opt/local/etc/sudoers` file
and comment out the above Defaults line.
P.S. One could set the Defaults line to something like:
{{{
Defaults secure_path=$PATH
}}}
But that would defeat the whole purpose of the `secure_path` variable
since a script or a person could easily change the `PATH` variable.
I commented out the `Defaults secure_path` line and now everything works!
`sudo` can now find the `port` command.
P.S. You may want to see https://unix.stackexchange.com/questions/83191
/how-to-make-sudo-preserve-path
--
Ticket URL: <https://trac.macports.org/ticket/70680#comment:18>
MacPorts <https://www.macports.org/>
Ports system for macOS
More information about the macports-tickets
mailing list