Problems related to the "sudo" command in Ubuntu

Introduction

This article will introduce how to solve some problems when using the "sudo" command in Ubuntu.

Situation 1  

Error message:
 sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set

Solution: 
chmod 440 /etc/sudoers
chmod 775 /etc/sudoers.d

Situation 2 

Error message:
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
Solution: 
chmod 440 /etc/sudoers.d/README
chown root:root /usr/bin/sudo
chmod 4755 /usr/bin/sud

Situation 2 

Error message: sudo:  /etc/sudoers.d is world writeable
Solution1:
pkexec chmod 0755 /etc/sudoers.d/
当使用plexec命令提示以下错误,请按下面的另一个方法操作。

Solution2:

重启服务器按Esc,进入advance option,然后进入该内核的recovery mode,再进入root下面运行以下命令
chmod 0440 /etc/sudoers

Add Feedback