今天安装Ansible受控端服务器时,发现有一台服务器sudo报错,经查,发现是sudo权限被配错了,我估计是之前谁给777了。对照另外一台修改恢复了。
错误
setuid权限错误
- 错误提示
bash
sudo: effective uid is not 0, is sudo installed setuid root?
- 解决办法
bash
chmod 4755 /usr/bin/sudo
bash
ll /usr/bin/sudo
-rwsr-xr-x. 1 root root 123832 6月 23 2017 /usr/bin/sudo
库文件权限错误
- 错误提示
bash
sudo: /usr/libexec/sudoers.so must be only be writable by owner
- 解决办法
bash
chmod 755 /usr/libexec/sudoers.so
bash
ll /usr/libexec/sudoers.so
-rwxr-xr-x. 1 root root 296072 6月 23 2017 /usr/libexec/sudoers.so