19

For some reason, when I try to run any programs (I am trying to run a rootkit hunter: rkhunter) as root on the command line with sudo like this:

sudo rkhunter

Then I get this message:

You must be the root user to run this program

and then I get these lines:

sudo: error in /etc/sudo.conf, line 0 while loading plugin 'sudoers_policy'
sudo: /usr/lib/sudo/sudoers.so must only be writable by owner
sudo: fatal error, unable to load plugins

I try typing in just sudo but that comes up with the same three errors as above. Also in /etc/ sudo.conf does not exist.

I cannot run any other programs as root through sudo. It was also strange because I could run as root a day ago. I would like it to work.
Just so you know, I am the only user of this computer, and the administrator, running Lubuntu 14.04.1.

4 Answers 4

44

If you can login as root:

$ su root     #enter password
$ chmod 644 /usr/lib/sudo/sudoers.so
$ chown -R root /usr/lib/sudo

**

  • on ubuntu 22.04 the proper directory for sudoers.so is /usr/libexec/sudo/sudoers.so

**

If not, you'll have to startup in recovery mode, get write permission on your disk, and change the mode of that file. https://wiki.ubuntu.com/RecoveryMode

$ mount -o remount,rw /
$ chmod 644 /usr/lib/sudo/sudoers.so

**

on ubuntu 22.04 the proper directory for sudoers.so is /usr/libexec/sudo/sudoers.so

**

5
  • I'm using a headless raspberry pi - how would I start in recovery mode without a keyboard or monitor?
    – Big Money
    Jun 15, 2019 at 20:46
  • Doesn't it have a sdcard that you easily can adjust on your desktop/laptop? Jun 17, 2019 at 0:36
  • It does have an sdcard, good thinking, I can just plug it in and boot from there
    – Big Money
    Jun 17, 2019 at 20:20
  • 2021, still works :) May 3, 2021 at 19:47
  • You can also login as root on WSL using wsl -u root from PowerShell or CMD Apr 5, 2023 at 14:06
4

1st open your terminal then type and enter

pkexec su

it will log you in as a root user

now type (replace username with your PC's username):

chown -R username /usr/lib/

now open file explorer and goto /usr or type this in another terminal: nautilus /usr

now, right click on the lib folder and goto 'Permissions' tab.

From there change the access of 'Group' and 'Others' to- 'Access files'

now click on the button 'Change Permissions for Enclosed Files' now change the access of 'Group' and 'Others' to- 'Access files' or 'Read-only'.

now close that window and return to the terminal(the one with root user).

now type

chown -R root /usr/lib/

voila!

now you can use sudo again.

0

If you can't login as root, then start Ubuntu in recovery mode, from the menu select "Drop to shell prompt", press Enter, and then type the following:

mount -o remount,rw /
mount --all
chmod 644 /usr/lib/sudo/sudoers.so
chown -R /usr/lib/sudo/

You should be able to run "sudo" commands now, including here, in recovery mode console, for example you can just run sudo to test if it was fixed.

**

on ubuntu 22.04 the proper directory for sudoers.so is /usr/libexec/sudo/sudoers.so

**

0

my problem got solved with these steps:

  • booted into my USB device

  • mounted my linux hardwares

  • accessed the root

  • created a file like this:

    nano /etc/sudoers

  • added

    root ALL=(ALL:ALL) ALL

  • and saved

  • created another file:

    nano /etc/resolv.conf

  • added:

    nameserver 8.8.8.8

  • saved

it worked instantly

reboot

sudo -l

it gaves the following: (ALL : ALL) ALL

my wifi settings were broken, so I used my USB Tethering from my mobile to update the wifi driver and the packages again.

my device is not using sudo anymore lol for some reason. now, I can type any command without sudo


side notes: I was chewing a gum when I started, my boss texted. a lot of pressure and I need to fix the project tomorrow morning. I forgot the gum on my laptop, it got sticked to my sleeves, hard to get out. I tried to sign up an account in this website, it refused cause apparently, I don't have cookies in my browser. oh.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .