今天安装Ansible受控端服务器时,发现有一台服务器sudo报错,经查,发现是sudo权限被配错了,我估计是之前谁给777了。对照另外一台修改恢复了。

错误

setuid权限错误

  • 错误提示
sudo: effective uid is not 0, is sudo installed setuid root?
  • 解决办法
chmod 4755 /usr/bin/sudo
ll /usr/bin/sudo
-rwsr-xr-x. 1 root root 123832 623 2017 /usr/bin/sudo

库文件权限错误

  • 错误提示
sudo: /usr/libexec/sudoers.so must be only be writable by owner
  • 解决办法
chmod 755  /usr/libexec/sudoers.so
ll  /usr/libexec/sudoers.so
-rwxr-xr-x. 1 root root 296072 623 2017 /usr/libexec/sudoers.so
04-21 10:27