Home >Operation and Maintenance >CentOS >What should I do if CentOS prompts that the command cannot be found when executing the sudo command?
First switch to the root user and edit the file /etc/sudoers as the root user:
# vim /etc/sudoers
Then find Defaults env_reset and change it to Defaults !env_reset. Then wq! force save and exit.
Then, switch back to a normal user, such as the user name is xx, edit the configuration file in the user root directory ~/.bashrc
# su xx $ vim .bashrc
Append
alias sudo='sudo env PATH=$PATH'# at the end of the file ##Finally, make the configuration file take effect
$ source ~/.bashrcRecommended tutorial:
The above is the detailed content of What should I do if CentOS prompts that the command cannot be found when executing the sudo command?. For more information, please follow other related articles on the PHP Chinese website!