Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Sudo service: how to solve the command not found error report

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "sudo service: how to solve command not found error reporting". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Next, let the editor take you to learn "sudo service: command not found error reporting how to solve" it!

Question:

After successfully configuring sudo, the execution of sudo / etc/init.d/httpd restart is normal.

However, there is an error in executing sudo service httpd restart:

Sudo: service: command not found

Solution:

1. Write the path of service to PATH.

$vi .bash _ profile

The code is as follows:

Export PATH=$PATH:/sbin

$source source

Note: this setting is not recommended, which increases the security risks.

two。 Modify Sudo configuration file / etc/sudoers

The code is as follows:

# visudo

Defaults env_keep = "COLORS DISPLAY HOSTNAME HISTSIZE INPUTRC KDEDIR\"

LS_COLORS MAIL PS1 PS2 QTDIR USERNAME\

LANG LC_ADDRESS LC_CTYPE LC_COLLATE LC_IDENTIFICATION\

LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC\

LC_PAPER LC_TELEPHONE LC_TIME LC_ALL LANGUAGE LINGUAS\

_ XKB_CHARSET XAUTHORITY PATH "

; add PATH.

# vi / etc/profile

The code is as follows:

# Path manipulation

# if ["$EUID" = "0"]; then

Modify to

Gid= `/ usr/bin/id-g`

If [$gid-eq 10]; then

At this point, I believe you have a deeper understanding of "sudo service: command not found error reporting how to solve", might as well come to the actual operation! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report