sudo service: command not found 报错的解决方法
问题:
配置成功sudo后,执行sudo /etc/init.d/httpd restart 正常。
但执行sudo service httpd restart出现一下错误:
sudo: service: command not found
解决方法:
1.将service的路径写入path.
$vi .bash_profile
export path=$path:/sbin
$source source
注意:不建议这样设置,这样加大了安全隐患。
2.修改 sudo 配置文件 /etc/sudoers
# 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"
;在env_keep中加入path.
#vi /etc/profile
# path manipulation
#if [ "$euid" = "0" ]; then ;
修改为
gid=`/usr/bin/id -g`
if [ $gid -eq 10 ];then
如对本文有疑问,
点击进行留言回复!!
网友评论