黑帽联盟
标题:
CentOS6 sudo: (whatever): command not found
[打印本页]
作者:
定位
时间:
2016-11-16 00:11
标题:
CentOS6 sudo: (whatever): command not found
普通用户用户具有sudo权限,但是执行一些命令的时候,出现command not found,具体看下面怎么解决
以下是解决方法:
1. 切换到root用户;
2. 运行visudo命令,编辑sudoers文件
2.1 将如下代码
Defaults env_reset
Defaults env_keep = "COLORS DISPLAY HOSTNAME HISTSIZE INPUTRC KDEDIR LS_COLORS"
Defaults env_keep += "MAIL PS1 PS2 QTDIR USERNAME LANG LC_ADDRESS LC_CTYPE"
Defaults env_keep += "LC_COLLATE LC_IDENTIFICATION LC_MEASUREMENT LC_MESSAGES"
Defaults env_keep += "LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER LC_TELEPHONE"
Defaults env_keep += "LC_TIME LC_ALL LANGUAGE LINGUAS _XKB_CHARSET XAUTHORITY"
改成
#Defaults env_reset
Defaults env_keep = "COLORS DISPLAY HOSTNAME HISTSIZE INPUTRC KDEDIR LS_COLORS"
Defaults env_keep += "MAIL PS1 PS2 QTDIR USERNAME LANG LC_ADDRESS LC_CTYPE"
Defaults env_keep += "LC_COLLATE LC_IDENTIFICATION LC_MEASUREMENT LC_MESSAGES"
Defaults env_keep += "LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER LC_TELEPHONE"
Defaults env_keep += "LC_TIME LC_ALL LANGUAGE LINGUAS _XKB_CHARSET XAUTHORITY"
Defaults env_keep += "*"
2.2 将
Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin
改为
#Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin
2.3 添加
ALL ALL=(ALL) NOPASSWD: ALL
或者
ALL ALL=(ALL) ALL
3. 重新用当前非root用户运行命令"sudo xxx"
欢迎光临 黑帽联盟 (https://bbs.cnblackhat.com/)
Powered by Discuz! X2.5