用户不在 sudoers 文件中。此事件将在 osx mac 中报告

问题描述 投票:0回答:2

嗨,我正在使用 mac osx,我尝试在没有密码的情况下登录 sudo,我按照 this 教程并在 sudoers 文件中编辑了此代码

chmod +w /etc/sudoers
USERNAME ALL=(ALL) NOPASSWD: ALL
chmod -w /etc/sudoers

但是现在当我尝试使用 sudo 命令运行任何脚本或尝试 sudo -i 时,它会给出此错误

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

唯一正在使用的用户意味着它的根用户,我也尝试过这个

MacBook-Air:~ exepaul$ sudo chmod +w /etc/sudoers Password: exepaul is not in the sudoers file. This incident will be reported.

所以请帮助我;(

macos terminal sudo recovery sudoers
2个回答
0
投票

以我为例,我只是

su root
然后输入自定义用户密码,然后切换到root!... 然后我将 root 密码更改为新密码


0
投票

运行这些命令:

苏根

nano /etc/sudoers

然后在管理员用户下面添加用户,如下语法。

%管理员全部=(全部)全部

用户名全部=(全部)全部

© www.soinside.com 2019 - 2024. All rights reserved.