码迷,mamicode.com
首页 > 系统相关 > 详细

Linux系统centos中sudo命令不能用----提升权限

时间:2018-09-17 21:29:58      阅读:281      评论:0      收藏:0      [点我收藏+]

标签:ide   use   文件的   file   The   port   lin   user   root   

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

1.切换到root用户 su ,如果想要切换回去 exit

2.添加sudo文件的写权限,命令是:
chmod u+w /etc/sudoers

3.编辑sudoers文件
vi /etc/sudoers
找到这行 root ALL=(ALL) ALL,在他下面添加xxx ALL=(ALL) ALL (这里的xxx是你的用户名)

ps:这里说下你可以sudoers添加下面四行中任意一条
youuser            ALL=(ALL)                ALL
%youuser           ALL=(ALL)                ALL
youuser            ALL=(ALL)                NOPASSWD: ALL
%youuser           ALL=(ALL)                NOPASSWD: ALL

第一行:允许用户youuser执行sudo命令(需要输入密码).
第二行:允许用户组youuser里面的用户执行sudo命令(需要输入密码).
第三行:允许用户youuser执行sudo命令,并且在执行的时候不输入密码.
第四行:允许用户组youuser里面的用户执行sudo命令,并且在执行的时候不输入密码.

4.撤销sudoers文件写权限,命令:
chmod u-w /etc/sudoers

Linux系统centos中sudo命令不能用----提升权限

标签:ide   use   文件的   file   The   port   lin   user   root   

原文地址:https://www.cnblogs.com/BlueFire-py/p/9664889.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!