问题描述:
配置成功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 配置文件
# 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
阅读(4909) | 评论(0) | 转发(0) |