打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
Ubuntu技巧之 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.其中XXX是你的用户名,也就是你的用户名没有权限使用sudo,我们只要修改一下/etc/sudoers文件就行了。

例子:

www_linuxidc_com@linuxidc-Aspire-3680:~$ sudo add-apt-repository ppa:stk/dev

[sudo] password for www_linuxidc_com:

www_linuxidc_com is not in the sudoers file.  This incident will be reported.

www_linuxidc_com@linuxidc-Aspire-3680:~$

下面是解决方法:

1)进入超级用户模式。也就是输入"su -",系统会让你输入超级用户密码,输入密码后就进入了超级用户模式。(当然,你也可以直接用root用)

(注意有- ,这和su是不同的,在用命令”su”的时候只是切换到root,但没有把root的环境变量传过去,还是当前用户的环境变量,用”su -”命令将环境变量也一起带过去,就象和root登录一样)

2)添加文件的写权限。也就是输入命令"chmod u+w /etc/sudoers"。

3)编辑/etc/sudoers文件。也就是输入命令"gedit /etc/sudoers",进入编辑模式,找到这一 行:"root ALL=(ALL) ALL"在起下面添加"www_linuxidc_com ALL=(ALL) ALL"(这里的xxx是你的用户名),然后保存退出。

4)撤销文件的写权限。也就是输入命令"chmod u-w /etc/sudoers"。

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
XXX is not in the sudoer file
使用用sudo时提示"### is not in the sudoers file. This incident will be reported.
linux基础(一)——切换到root用户和普通用户
Linux下root初始密码设置方法(转)
转贴:Ubuntu进入root权限命令
Linux 命令 su 和 sudo 的区别?
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服