[sudo] password for tom1: tom1 is not in the sudoers file. This incident will be reported.
时间: 2023-12-06 12:38:09 浏览: 81
根据提供的引用内容,出现"[sudo] password for user:"的提示是因为需要输入用户的密码才能使用sudo命令。而"work is not in the sudoers file"和"tom1 is not in the sudoers file"的提示则是因为这两个用户没有sudo权限,无法使用sudo命令。
如果您想让用户tom1拥有sudo权限,可以通过以下步骤进行设置:
1. 以root用户身份登录系统。
2. 执行以下命令打开sudoers文件:
```shell
visudo
```
3. 在文件中找到以下行:
```shell
root ALL=(ALL:ALL) ALL
```
4. 在该行下面添加以下内容:
```shell
tom1 ALL=(ALL:ALL) ALL
```
其中,tom1是您想要授权sudo权限的用户名。
5. 保存并退出文件。
现在,用户tom1就可以使用sudo命令了。
相关问题
[sudo] password for zhu: zhu is not in the sudoers file. This incident will be reported.
根据提供的引用内容,当用户尝试使用sudo命令时,如果用户不在sudoers文件中,则会收到类似的错误消息:"[用户名] is not in the sudoers file. This incident will be reported."。
以下是一个演示如何解决这个问题的方法:
1. 首先,需要以root用户身份登录到系统中。
2. 打开终端并输入以下命令来编辑sudoers文件:
```shell
sudo visudo
```
3. 在打开的文件中,找到以下行:
```shell
root ALL=(ALL:ALL) ALL
```
4. 在该行的下方添加一行,将[用户名]替换为你想要添加到sudoers文件的用户名:
```shell
[用户名] ALL=(ALL:ALL) ALL
```
例如,如果要将用户"zhu"添加到sudoers文件中,添加的行应该是:
```shell
zhu ALL=(ALL:ALL) ALL
```
5. 保存并关闭文件。
6. 现在,用户"[用户名]"应该可以使用sudo命令了。
[sudo] password for yx: yx is not in the sudoers file. This incident will be reported. 如何解决
要解决此问题,您需要具有管理员权限才能将用户添加到sudoers文件。以下是一种常见的解决方法:
1. 以管理员身份登录到系统。
2. 打开终端或命令提示符。
3. 运行以下命令以编辑sudoers文件:
```
visudo
```
4. 在打开的文件中查找以下行:
```
root ALL=(ALL:ALL) ALL
```
5. 在该行的下方添加以下内容(假设要将用户yx添加到sudoers文件中):
```
yx ALL=(ALL:ALL) ALL
```
6. 保存并关闭文件。
7. 现在,用户yx应该具有sudo权限。
请注意,对sudoers文件的更改可能会导致系统不稳定。如果您不确定如何进行更改,请咨询系统管理员或参考相关文档。
阅读全文
相关推荐















