sudo: /var/lib/sudo writable by non-owner (040777), should be mode 0700
Solution 1
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?.
Solution 2
"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
Related videos on Youtube
Saifullah Alam
Updated on September 18, 2022Comments
-
Saifullah Alam over 1 year
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 to777
.How can I fix it?
-
jlliagre over 8 yearsWhat command did you use to change /var permissions?
-
IanC over 7 yearsIt seems like the directory
/var/lib/sudo
doesn't have the right permissions. On my folder the permissions for this folder are: drwxr-xr-x root:root /var/lib/sudo So you could run:sudo chown root:root /var/lib/sudo
(just to make sure you have the right owner:group for the folder) andsudo chmod 755 /var/lib/sudo
to fix the permissions
-
-
Saifullah Alam over 8 yearssudo permission properties showing: owner: root group :root
-
kos over 8 years@SaifullahAlam Which "sudo" are you talking about? Anyway, have you tried my command? It should fix the problem.
-
Saifullah Alam over 8 yearsi tried your both command. firstly tried :
sudo chmod 0700 /var/lib/sudo
then triedsudo chmod go-w /var/lib/sudo
. have i try it from root(#)? -
kos over 8 years@SaifullahAlam No, just run
sudo chmod 0700 /var/lib/sudo
and nothing else. Then try to runsudo
(for whatever purpose) again. The message should be gone. -
Saifullah Alam over 8 yearssorry for disturbing. it not works. i tried.
-
kos over 8 years@SaifullahAlam No problem. Please install
tree
by runningsudo apt-get install tree
and add the output ofsudo tree -a /var/lib/sudo
to your question, and drop me a comment here so I know that you updated your question, I think you need to fix something else as well.