美文网首页
Ubuntu中xxx is not in the sudoers

Ubuntu中xxx is not in the sudoers

作者: BioLearner | 来源:发表于2019-02-12 11:06 被阅读14次

    用sudo时提示"xxx is not in the sudoers file. This incident will be reported.其中XXX是你的用户名,也就是你的用户名没有权限使用sudo,我们只要修改一下/etc/sudoers文件就行了。如图

    接着使用su root切换到root用户(也可使用su -命令切换,注意有- ,这和su是不同的,在用命令”su”的时候只是切换到root,但没有把root的环境变量传过去,还是当前用户的环境变量,用”su -”命令将环境变量也一起带过去,就象和root登录一样),修改/etc/sudoers文件即可,在"root ALL=(ALL) ALL"下面添加"xxx ALL=(ALL) ALL"(这里的xxx是你的用户名),然后保存退出(注意,默认该文件是只读的,则可以通过提前修改文件权限,或者在保存时使用 wq!进行强制保存修改)。

    参考:https://www.linuxidc.com/Linux/2010-12/30386.htm

    相关文章

      网友评论

          本文标题:Ubuntu中xxx is not in the sudoers

          本文链接:https://www.haomeiwen.com/subject/xwmheqtx.html