I updated the OS to 15.5 from 15.4. When executing an app with sudo, the app is not found even though it is in the PATH.
$ sudo echo $PATH
/home/sma-user3x/bin:/usr/local/bin:/usr/bin:/bin:/usr/lib/mit/bin:/snap/bin
$ sudo fail2ban-client get cgpro-smtp banned
sudo: fail2ban-client: command not found
$ which fail2ban-client
/usr/local/bin/fail2ban-client
$ sudo which fail2ban-client
which: no fail2ban-client in (/usr/sbin:/usr/bin:/sbin:/bin)
sudo is not using root’s PATH, or the PATH of the current user. Instead it is using a default PATH.
After changing “Default env_reset” to “Default !env_reset”, and adding PATH to “env_keep”, here is a relevant line from sudo sudo -V: Value to override user's $PATH with: /usr/sbin:/usr/bin:/sbin:/bin