Artificial intelligent assistant

Command not found when run as sudo I'm running centos7. I installed puppet. if I write `puppet` as a user, I get a proper output. If I write `sudo puppet` I get `command not found`. The really weird thing is, if I do `sudo su -` and become root, then write `puppet`, I get the normal output that I get when I run it with the normal user... [unu@centosmaster puppet]$ puppet See 'puppet help' for help on available puppet subcommands [unu@centosmaster puppet]$ sudo puppet sudo: puppet: command not found [unu@centosmaster puppet]$ sudo su - Last login: Wed Sep 19 08:41:20 EDT 2018 on pts/0 [root@centosmaster ~]# puppet See 'puppet help' for help on available puppet subcommands This, to me, makes absolutely no sense... The `$PATH` variable is the same for root and normal user.

According to this question on Super User site, CentOS sanitizes the enviromnent to a sane default.

That's why some commands won't work with `sudo`.

Looks like you should check in `/etc/sudoers` (edit it with `visudo` !!) for these options:


Defaults env_reset
Defaults env_keep += "SOME_VARIABLE_NAME" # There should be one or more of these


This line:


Defaults secure_path = "some path"


specifically overrides your user's `$PATH` with a predetermined one which evidently differs from what you're expecting.

You might want to modify `secure_path` to your needs, or just comment the whole line if you feel your standard user's `$PATH` should be used even with `sudo [command]`.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 4435e2f601d50fa2fdae0a79c4c1cc6e