Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Macos 用户不在sudoers文件中。此事件将在osx mac中报告_Macos_Terminal_Sudo_Recovery_Sudoers - Fatal编程技术网

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

Macos 用户不在sudoers文件中。此事件将在osx mac中报告,macos,terminal,sudo,recovery,sudoers,Macos,Terminal,Sudo,Recovery,Sudoers,您好,我使用的是MacOSX,我尝试不用密码登录sudo,我遵循了教程,并在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. 这个唯一使用它的用

您好,我使用的是MacOSX,我尝试不用密码登录sudo,我遵循了教程,并在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密码:exepaul不在sudoers文件中。将报告此事件。

所以请帮助我;(

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

您的用户帐户肯定是mac的管理员吗?(不考虑sudoers文件)?听起来您没有遵循“用短用户名替换用户名”的说明欢迎使用堆栈溢出!这是如何回答问题的?OP在使用
sudo
而不是
su
时遇到问题。