今天作死改了/usr/bin文件夾的下一些文件的權限,就出這個問題了·····
Ubuntu16.04執行sudo命令時報以下錯誤:
sudo: error in /etc/sudo.conf, line 0 while loading plugin ‘sudoers_policy’
sudo: /usr/lib/sudo/sudoers.so must only be writable by owner
sudo: fatal error, unable to load plugins
導致的原因:用ll查看了一下sudoer.so和sudo的用戶權限,發現owner都是非root用戶,所以才導致當前用戶沒有權限執行sudo命令,修改權限後,即可解決此問題。
解決方法:
chmod 644 /usr/lib/sudo/sudoers.so
chown -R root /usr/lib/sudo
但是此時不能用下面出處的第二句命令,否則會出現下面的錯誤:
chown: changing ownership of '/usr/lib/sudo/sudoers.so': Operation not permitted
chown: changing ownership of '/usr/lib/sudo/sesh': Operation not permitted
chown: changing ownership of '/usr/lib/sudo/group_file.la': Operation not permitted
chown: changing ownership of '/usr/lib/sudo/group_file.so': Operation not permitted
chown: changing ownership of '/usr/lib/sudo/sudo_noexec.so': Operation not permitted
chown: changing ownership of '/usr/lib/sudo/sudo_noexec.la': Operation not permitted
chown: changing ownership of '/usr/lib/sudo/libsudo_util.so.0.0.0': Operation not permitted
chown: changing ownership of '/usr/lib/sudo/libsudo_util.so.0': Operation not permitted
chown: changing ownership of '/usr/lib/sudo/system_group.la': Operation not permitted
chown: changing ownership of '/usr/lib/sudo/libsudo_util.so': Operation not permitted
chown: changing ownership of '/usr/lib/sudo/libsudo_util.la': Operation not permitted
chown: changing ownership of '/usr/lib/sudo/system_group.so': Operation not permitted
chown: changing ownership of '/usr/lib/sudo/sudoers.la': Operation not permitted
chown: changing ownership of '/usr/lib/sudo': Operation not permitted
正確的姿勢
chmod 644 /usr/lib/sudo/sudoers.so
su
輸入密碼進入su
chown -R root /usr/lib/sudo