Whenever I run a sudo command in the terminal, this happens:

arun@arun-GP70-2OD:~$ sudo apt-get update
sudo: /etc/sudoers.d/README is world writable
sudo: /var/lib/sudo writable by non-owner (040777), should be mode 0700
 [sudo] password for arun:

The sudo commands still work (I think so, although the only one I have tested is sudo apt-get).

What are these strange messages before I get asked for the password? Is there any big problem here? Should I do something about this? Or can I just leave it like this and continue using my system?

  • Well, did you check the permission on /etc/sudoers.d/README file as the error suggested ? – Sergiy Kolodyazhnyy Mar 28 '16 at 9:30
  • 3
    I'd be concerned about overall system security/stability at this point, as clearly something has happened to screw up permissions. It may be the relatively safe option of a filesystem becoming corrupt, or something more insidious. – Phil Lello Mar 28 '16 at 19:32
  • @Phil Lello Yes, I formated my drive and did a clean install. More details in the comments under the accepted answer. – Revetahw says Reinstate Monica Mar 28 '16 at 19:43

The messages are self explanatory.

By design sudo related files and libraries should only be readable (and writable if needed) by root.

The directory /var/lib/sudo contains individual user's sudo related data, which could be easily read/modified if a non-root user have sufficient permission, which is of course a security issue.

The file /etc/sudoers.d/README contains info regarding implementation of sudo. Imagine a rogue user edit the file and add false info (and you follow that).

So, in a nutshell, fix the permissions:

sudo chmod 0400 /etc/sudoers.d/README
sudo chmod -R 0700 /var/lib/sudo  ## Recursively

And of course make sure the owner is root (and group root).

| improve this answer | |
  • Comments are not for extended discussion; this conversation has been moved to chat. – Oli Mar 28 '16 at 10:48
  • @heemayl Maybe it's worth adding to the answer that whatever caused a problem like this might possibly have caused other security problems as well? I, fearing this, formated my drive and did a clean install. – Revetahw says Reinstate Monica Mar 29 '16 at 4:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.