yum is not in the sudoers file. This incident will be reported.
时间: 2023-12-31 15:24:49 浏览: 135
根据提供的引用内容,当执行`sudo yum -y update`命令时,出现了"sandwich is not in the sudoers file. This incident will be reported."的错误提示。这是因为用户"sandwich"没有sudo权限,无法执行sudo命令。
要给用户"sandwich"分配sudo权限,可以按照以下步骤进行操作:
1. 切换回root用户:
```shell
[sandwich@192 ~]$ su root
Password:
```
2. 添加sudo文件的写权限:
```shell
[root@192 sandwich]# chmod u+w /etc/sudoers
```
3. 给sudoers文件添加新用户:
```shell
[root@192 sandwich]# visudo
```
在打开的sudoers文件中,找到以下行:
```shell
## Allow root to run any commands anywhere
root ALL=(ALL) ALL
```
在该行下面添加以下内容:
```shell
## Allow sandwich to run yum with sudo
sandwich ALL=(ALL) /usr/bin/yum
```
保存并退出sudoers文件。
现在,用户"sandwich"就被授予了sudo权限,可以执行`sudo yum -y update`命令了。
阅读全文
相关推荐








