• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
VMT
博客园    首页    新随笔    联系   管理    订阅  订阅

CentOS7──xxx is not in the sudoers file

提示"xxx is not in the sudoers file. This incident will be reported.其中 ”XXX“是你的用户名,也就是你的用户名没有权限使用sudo,我们只要修改一下/etc/sudoers文件就行了。
下面是修改方法:
1)进入超级用户模式。打开'Open Terminal' 输入"su",系统会让你输入超级用户密码,输入密码后就进入了超级用户模式。(当然,你也可以直接用root权限) 
2)添加文件的写权限。"[root@localhost admin]"下,输入命令"chmod u+w /etc/sudoers"。 
3)编辑sudoers文件。输入命令"vim /etc/sudoers",输入"a"进入编辑模式,找到这一 行:"Allow root to ruan any commands anywhere"在【root ALL=(ALL) ALL】下面一行添加"xxx ALL=(ALL) ALL"(这里的xxx是你的用户名),然后保存(就是先按一 下Esc键,然后输入":wq")退出。 
4)撤销sudoers文件的编写权限。输入命令"chmod u-w /etc/sudoers"
5)"XXX"用户获得了权限。
posted @ 2017-08-23 13:49  VMT  阅读(399)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3