TA的每日心情 | 无聊 5 天前 |
---|
签到天数: 1644 天 [LV.Master]伴坛终老
|
普通用户用户具有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"
|
|