2

This question already has an answer here:

I am trying to configure apache2 with cgi (python).

For that, I have to change permissions of some folders and files but I am getting sudo fatal errors every time I try to change the permission of a file or a Folder.

For Example:

1

j@ubuntu:/etc/apache2$ ls

apache2.conf envvars magic mods-enabled sites-available

conf.d httpd.conf mods-available ports.conf sites-enabled

j@ubuntu:/etc/apache2$ sudo chmod 777 httpd.conf

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

sudo: fatal error, unable to load plugins

...................................................................................

2

j@ubuntu:/usr/lib/cgi-bin$ sudo /etc/init.d/apache2 restart

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

sudo: fatal error, unable to load plugins

...................................................................................

3

j@ubuntu:/usr/lib$ sudo chmod -R 777 /usr/lib/cgi-bin

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

sudo: fatal error, unable to load plugins

...................................................................................

Note:

j@ubuntu:/etc/apache2$ ls -l /usr/lib/sudo/sudoers.so

-rwxrwxrwx 1 root root 177452 Jan 31 2012 /usr/lib/sudo/sudoers.so

marked as duplicate by karel, Fabby, George Udosen, Charles Green, Zanna Nov 21 '18 at 9:45

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • type su into terminal this should give you rout privileges then you do not have to use the sudo command. – SimplySimon Jun 6 '13 at 9:35
  • @SimplySimon- Thanks for replying back. When I typed su, it asked me for password and then it says authentication failure. – jags Jun 6 '13 at 9:37
  • Are trying to edit these files? – Mitch Jun 6 '13 at 9:37
  • 1
    Try sudo vi <pathtofile/file_name> – Mitch Jun 6 '13 at 9:39
  • Have not come across vi before, looks interesting. – SimplySimon Jun 6 '13 at 9:43
2

From the comments, it looks like anything run with sudo will fail because of this. Does it work if you use pkexec instead? For example:

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

This should remove write permissions from "group" and "other", and leave the "user" (owner) permission intact.

Edit: Whoops, wrote sudo in the command by mistake. Fixed now.

0

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.

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