Linux - Sudo - Sudoers - Set a Secure PATH

This is the path used for every command run with sudo, it has two importance :

  1. Used when a system administrator does not trust sudo users to have a secure PATH environment variable.
  2. To separate “root path” and “user path”, only users defined by exempt_group are not affected by this setting.

To set it, add the line:

Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"