macOS login: Could not determine audit condition

 原创    2019-06-18

macOS login: Could not determine audit condition

误操作chown -R 777 /usr/bin导致macOS终端出现以下错误:

login: Could not determine audit condition

修改/usr/bin权限之后,login,sudo等命令无法正常使用,导致终端都无法打开。网传的直接删除/usr/bin/login文件的解决方式太粗暴,肯定有隐藏问题。下面是亲测有效的一种恢复方法。

一,开启macOS root权限

操作路径:
macOS->System Preferences->Users & Groups->Login Options->Click the lock to make changes->Newwork Account Server->Open Directory Utility->Click the lock to make changes->Edit->开启或关闭root账号

二,进入root账号后修改

以root账号登入系统,执行以下命令:

chown root:wheel /usr/bin/login
chmod 4755 /usr/bin/login

chown root:wheel /usr/bin/sudo
chmod 4755 /usr/bin/sudo

//恢复原有权限
chmod g-w /usr/bin
chmod o-w /usr/bin

cd /usr/bin
chmod g-w
chmod o-w

切换到正常账号即可。安全起见,最好关闭root账号。

相关文章:

macOS升级PHP7及Apache错误排查笔记

发表留言

您的电子邮箱地址不会被公开,必填项已用*标注。发布的留言可能不会立即公开展示,请耐心等待审核通过。