I have a strange issue where sudo is not preserving the PATH by default. I tried the answers from this question and it works when I use the sudo env "PATH=$PATH" version but I want to fix this permanently.
Here's my PATH as regular user and under sudo:
$ echo $PATH
/usr/local/bin:/bin:/usr/bin:/opt/jdk/bin:/opt/python3/bin:/opt/qt5/bin
$ sudo printenv | grep 'PATH'
PATH=/bin:/usr/ucb:/usr/bin:/usr/sbin:/sbin:/usr/etc:/etc
I tried sudo -E and sudo "PATH=$PATH but they don't work either. sudo env "PATH=$PATH" works but I have to type it every time run sudo. I want to avoid doing that every time I run sudo.
I'm not sure where sudo is picking up this path from. I don't have secure_path hard-coded or env_reset in /etc/sudoers. Hence this is not a duplicate of this question.
Any ideas what is going on and how to fix this? I would prefer not create aliases or hard-code the secure_path.
Edit:
As requested, the output of sudo -l:
$ sudo -l
User munir may run the following commands on munir-lfs:
(ALL) NOPASSWD: ALL