---
title: "is not in the sudoers file(解决)"
author: "superich2008"
date: "2014-05-06T10:16:58Z"
tags: ["sudo"]
categories: ["操作系统"]
slug: "is-not-in-the-sudoers-file"
draft: false
lastmod: "2014-05-06T10:21:45Z"
id: 2061951
url: "https://superich2008.iteye.com/blog/2061951"
---

解决方案：
首需要切换到root身份
$su -
(注意有- ，这和su是不同的，在用命令"su"的时候只是切换到root，但没有把root的环境变量传过去，还是当前用户的环境变量，用"su -"命令将环境变量也一起带过去，就象和root登录一样)

然后
# visudo     //<span style="color:red">此处vi和sudo之间没有空格，切记！！！</span>

1、移动光标，到最后一行（Shift+G）
2、按o，新插入一行
3、输入：
your_user_name   ALL=(ALL)       ALL
4、按Esc
5、输入“:x”(保存并退出)

这样就把自己加入了sudo组，可以使用sudo命令了。