sudo: /var/lib/sudo writable by non-owner (040777), should be mode 0700

I get error message always when I work with sudo command.

It shows always sudo: /var/lib/sudo writable by non-owner (040777), should be mode 0700.

A while ago I changed the permission of /var folder to 777.

How can I fix it?


Open the terminal and type:

sudo chown -R root:sudo /var/lib/sudo   
sudo chmod -R 700 /var/lib/sudo  

If sudo still does not work, you'll have to fix it from a root shell from the GRUB menu by following the instructions from: How do I add myself back as a sudo user?.


"Writable by non-owner" means that the current permissions of /var/lib/sudo allow either the file's group group or the file's other group to write into the directory, whilst only the owner (root) should be able to do so.

Removing the write permission for the group group and for the other group (chmod go-w /var/lib/sudo) should suffice, however since the suggested permissions are 0700, just go for those:

sudo chmod 0700 /var/lib/sudo