Monday, April 29, 2024
 Popular · Latest · Hot · Upcoming
7
rated 0 times [  7] [ 0]  / answers: 1 / hits: 18356  / 1 Year ago, sat, may 13, 2023, 9:56:28

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?


More From » nautilus

 Answers
2

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.


[#38041] Sunday, May 14, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
bjecterless

Total Points: 59
Total Questions: 96
Total Answers: 105

Location: Argentina
Member since Thu, Mar 18, 2021
3 Years ago
bjecterless questions
;