What should I do if CentOS prompts that the command cannot be found when executing the sudo command?

王林
Release: 2020-05-17 10:32:43
Original
3426 people have browsed it

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
Copy after login

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
Copy after login

Append

alias sudo='sudo env PATH=$PATH'
Copy after login
# at the end of the file ##Finally, make the configuration file take effect


$ source ~/.bashrc
Copy after login
Recommended tutorial:

centos 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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!