在 Raspbian 上,尝试更改用户编辑文件的权限/etc/sudoers.d/octoprint-shutdown
并且pi
成功了,但现在我什么也做不了sudo
。
我用来破解它的命令:
pkexec chown pi:pi /etc/sudoers /etc/sudoers.d -R
我尝试修复它但失败了:
pi@fluidd:~ $ pkexec chown root:root /etc/sudoers /etc/sudoers.d -R
==== AUTHENTICATING FOR org.freedesktop.policykit.exec ===
Authentication is needed to run `/usr/bin/chown' as the super user
Authenticating as: ,,, (pi)
Password:
polkit-agent-helper-1: error response to PolicyKit daemon: GDBus.Error:org.freedesktop.PolicyKit1.Error.Failed: No session for cookie
==== AUTHENTICATION FAILED ===
Error executing command as another user: Not authorized
pi@fluidd:~ $ sudo -i
sudo: /etc/sudoers is owned by uid 1000, should be 0
sudo: no valid sudoers sources found, quitting
sudo: error initializing audit plugin sudoers_audit
pi@fluidd:~ $ su -
Password:
su: Authentication failure
看起来 Raspbian 默认配置为无法使用密码登录 root 帐户,所以我有点不知道该怎么做。谢谢!
答案1
您可能需要在实时环境中修复此问题。您可以在另一台机器上安装 SD 卡,然后从那里调整权限。