Recently I had to change the folder permissions of /usr folder. Now the whole sudo is not working. If I try to update my system using this command:

sudo apt-get update

I get the following message:

sudo: /usr/lib/sudo/sudoers.so must be only be writable by owner
sudo: fatal error, unable to load plugins

So I tried to change the folder permissions by opening Nautilus as root by using this command

gksudo nautilus

But nothing happened. Nautilus didn't open. This is an emergency as the whole of sudo is not working. when I tried searching the solution from Google many suggested re-installation. I don't prefer re-installation. so is there any other solution?

  • related question -> askubuntu.com/questions/43621/… – hhlp May 29 '12 at 6:36
  • 2
    Please include HOW you changed permissions on /usr. Default perms on sudoers.so are 644, owned by root:root – ish May 29 '12 at 6:37
  • 3
    "I had to change the folder permissions of /usr folder." Care to give us the reason? I am interested since I do not believe there is one that has someone messing with the permissions of /usr. – Rinzwind May 29 '12 at 6:37

There are actually two mechanisms set up in Ubuntu for performing administrative tasks. sudo is one of them, and it and its graphical frontends (like gksu and gksudo) are not going to work until you fix the permissions problem.

The other mechanism is PolicyKit. Depending on exactly what you have done to your file permissions, it's likely that you can still recover using PolicyKit to run commands as root.

The pkexec command will run any (nongraphical) command as root (provided that the user invoking it is an administrator on the system). pkexec is capable of running graphical commands (like nautilus) as root, too, but this is quite nontrivial, as you have to set up configuration files for them describing how they are supposed to be run and what they are supposed to be allowed to do. Therefore, you're best off using the command-line to fix this problem...at least to the point where sudo works again. (Then you can run gksu nautilus to get a root file browser, if you're more comfortable using that to edit file permissions recursively.)

I don't know exactly what you did to your permissions, so it's hard for me to give you a specific pkexec command to run, to fix the problem. But you can rectify the specific problem that sudo is currently complaining about. It says:

sudo: /usr/lib/sudo/sudoers.so must be only be writable by owner

So remove group and other write permissions (while not modifying owner write permissions) for that file:

pkexec chmod go-w /usr/lib/sudo/sudoers.so

Then you can see if sudo works (by running some innocuous command like sudo ls).

If you need to perform other operations on file permissions from the command-line with chmod, see man chmod.

(By the way, here's another, related situation where it's handy to know about pkexec.)

If you have trouble getting pkexec to work for this, please feel free to comment here, and I'll try to render further assistance. But you should know that even if this method does not work, you shouldn't have to reinstall Ubuntu.

Instead, you can fix the problem from an Ubuntu live CD/DVD or live USB system, because the live system will be functioning--sudo will work on it--and you can mount your Ubuntu partition and change the permissions that way.

Or as a third option (as forestpiskie has suggested), you could use recovery mode.

| improve this answer | |
  • Thank you! the pkexec command did the work and sudo is working again,thank you! – Bharat May 29 '12 at 12:43

I would try booting into recovery mode and setting the permissions back to what they were.

Reboot - choose second item from menu to get to recovery mode.

recently I had to change the folder permissions of /usr folder

What asked you to change permissions of the whole /usr folder?

| improve this answer | |
  • "setting permission back to what they were" - I have changed them and do not know what they were!! – sangharsh Oct 11 '15 at 10:05

install Users And Groups using this
go to Manage Groups
and add you to sudo group

| improve this answer | |
  • 2
    This will not help. The problem isn't that the original poster is not in the sudo group. The problem is that sudo refuses to work for any user, because it sees that it is itself set up insecurely (with some of its own files accessible by all users). – Eliah Kagan May 29 '12 at 6:08

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.