当执行sudo时提示“is not in the sudoers file”的解决方案:
2013-12-04 02:32
375 查看
出现这种提示是由于普通用户帐号没有权限执行sudo命令,所以需要切换到root身份进行颁发权限:
$su -
(注意有- ,这和su是不同的,在用命令"su"的时候只是切换到root,但没有把root的环境变量传过去,还是当前用户的环境变量,用"su -"命令将环境变量也一起带过去,就象和root登录一样)
然后执行:
$ visudo //切记,此处没有vi和sudo之间没有空格
也可以添加/etc/sudoers文件拥有写的权限,再编辑该文件(注意编辑完再恢复为只读权限):
chmod u+w /etc/sudoers
vi /etc/sudoers
进入编辑/etc/sudoers:
root ALL=(ALL) ALL 的一行下面追加一行:
your_user_name ALL=(ALL) ALL
回到命令模式,用wq保存退出。
这样就把自己加入了sudo组,可以使用sudo命令了。
有关su和sudo以及visudo的介绍,有篇不错的文档,可推荐阅读:http://hi.baidu.com/ryanlive/item/2dcb6cf41225f2b330c199b6
$su -
(注意有- ,这和su是不同的,在用命令"su"的时候只是切换到root,但没有把root的环境变量传过去,还是当前用户的环境变量,用"su -"命令将环境变量也一起带过去,就象和root登录一样)
然后执行:
$ visudo //切记,此处没有vi和sudo之间没有空格
也可以添加/etc/sudoers文件拥有写的权限,再编辑该文件(注意编辑完再恢复为只读权限):
chmod u+w /etc/sudoers
vi /etc/sudoers
进入编辑/etc/sudoers:
root ALL=(ALL) ALL 的一行下面追加一行:
your_user_name ALL=(ALL) ALL
回到命令模式,用wq保存退出。
这样就把自己加入了sudo组,可以使用sudo命令了。
有关su和sudo以及visudo的介绍,有篇不错的文档,可推荐阅读:http://hi.baidu.com/ryanlive/item/2dcb6cf41225f2b330c199b6
相关文章推荐
- 一般用户下执行sudo命令提示sunxi is not in the sudoers file. This incident will be reported
- sodu时提示:XXX is not in the sudoers file. This incident will be reported
- xxx is not in the sudoers file 解决方案(转)
- xx is not in the sudoers file问题的解决方案
- Fedora提示 xxxis not in the sudoers file.this inc...
- is not in the sudoers file 解决方案
- Fedora提示 xxxis not in the sudoers file.this incident will be reported解决办法 [转]
- ubuntu下is not in the sudoers file 解决方案
- Fedora提示 xxxis not in the sudoers file.this incident will be reported解决办法
- Fedora提示 xxxis not in the sudoers file.this incident will be reported解决办法
- XXX is not in the sudoers file 解决方案:赋予linux普通用户挂载光驱的权限
- 普通用户执行sudo报hadoop is not in the sudoers file
- 使用用sudo时提示"### is not in the sudoers file. This incident will be reported.
- xxx is not in the sudoers file. This incident will be reported的错误解决方案
- 用sudo时提示"xxx is not in the sudoers file. "
- ubuntu系统提示“is not in the sudoers file”解决方法
- 解决用户执行sudo 报错:xxx is not in the sudoers file. This incident will be reported
- is not in the sudoers file解决方案
- xx is not in the sudoers file 问题的解决方案
- 用sudo时提示"xxx is not in the sudoers file. This incident will be reported 的解决办法