Linux下面给用户添加sudo权限

来源:互联网 发布:房卡麻将源码微信 编辑:程序博客网 时间:2024/06/07 04:54
在刚装上一个linux系统的时候,想要用sudo命令的时候会提示如下信息:
xxxis not in the sudoers file.  This incident will be reported. 
这里,xxx是用户名称,然后导致无法执行sudo命令
我们可以给用户添加一下sudo权限。
1.键入转为超级用户命令,也就是
<pre name="code" class="html">su root

将自己的身份变成超级用户。
2.添加文件写的权限
输入
chmod u+w /etc/sudoers

3.编辑/etc/sudoers文件
输入
vim /etc/sudoers

进入编辑模式,找到这一 行:"root ALL=(ALL) ALL"在起下面添加"xxx ALL=(ALL) ALL"(这里的xxx是你的用户名),然后保存退出。

0 0
原创粉丝点击