Home > Operation and Maintenance > CentOS > How to solve the problem that sudo command cannot be found under centos

How to solve the problem that sudo command cannot be found under centos

WJ
Release: 2020-06-03 15:44:26
Original
5795 people have browsed it

How to solve the problem that sudo command cannot be found under centos

How to solve the problem that the sudo command cannot be found under centos?

1. Problem description

Scenario:

Execute the following command

$ ssserver -p 443 -k password -m rc4-md5
Copy after login

It prompts insufficient permissions.

So add sudo before the command:

$ sudo ssserver -p 443 -k password -m rc4-md5
Copy after login

It prompts that the command cannot be found.

2. Solution

Switch to the root user and edit the file /etc/sudoers as the root user:

# vim /etc/sudoers

Find Defaults env_reset, change it to Defaults !env_reset,

thenwq! 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 , Make the configuration file take effect

$ source ~/.bashrc
Copy after login

Test whether the sudo execution command is normal

$ sudo ssserver -p 443 -k password -m rc4-md5 --user nobody -d start
2016-11-28 12:15:45 INFO     loading libcrypto from libcrypto.so.10
started
$
Copy after login

Related references:centOS tutorial



The above is the detailed content of How to solve the problem that sudo command cannot be found under centos. 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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template