0

I was messing around with permissions on my pi today and I managed to accidentally change the permissions on /usr/lib/sudo/sudoers.so to anyone can view anyone can write and nobody can execute. After this, it throws this error when you prefix anything with sudo:

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

I've tried changing it back but the permission is denied. I assume the problem is that I'm not editing the permissions as root and therefore I think I have a circular problem. I need root so I can fix my root. does anyone have a solution to this? My only idea is to take out the micro SD card and throw it into my main PC while it's booted off of a Debian Live CD and I have tried it though I stopped after Debian threw a fit with my Nvidia graphics. I'm here for any other solutions that don't involve taking my main PC apart temporarily as this seems to have little to no impact on my Pi's main function as a personal VPN server though it does make it impossible to start my FTP server. Thank you for your time.

  • It is unclear what you hoped to achieve by fiddling with /usr/lib/sudo/sudoers.so which is a library - ALL should be -rw-r--r-- 1 root root What are the current permissions? – Milliways Feb 13 '18 at 22:36
  • To edit the sudoers file next time you should use visudo. – Fabian Feb 13 '18 at 22:53
  • I know that messing with permissions is a great way to break your system, I did manage to handicap Win10 on my main desktop with permissions, however I was just changing many permissions at once and this file got caught in it. Thank you for your reply, – Funtime60 Feb 14 '18 at 17:10
0

You can repair most such problems on the Pi by rebooting to a root shell.

  1. Append init=/bin/sh at the end of cmdline.txt and reboot.
  2. After booting you will be at the prompt in a root shell.
  3. Your root file system is mounted as readonly now, so remount it as read/write mount -n -o remount,rw /

You can then edit files.

  • 1
    Hm, didn't realized this thing with no root password ... – Ingo Feb 13 '18 at 23:44
  • 1
    It seems I need root access to append to 'cmdline.txt'. The original problem is that I broke sudo so I have no root access and therefore this doesn't seem to be viable. What am I doing wrong. Besides everything. Thank you. – Funtime60 Feb 14 '18 at 17:05
  • @Funtime60 You can put the sd card from the raspi into a card reader of your pc (that one you have flashed the raspbian image), mount the first partition and edit cmdline.txt. – Ingo Feb 14 '18 at 22:41
  • @Funtime60 But if you have the sd card already in the reader you can also mount the second partition and correct permissions e.g. sudo chmod 644 /mnt/usr/lib/sudo/sudoers.so. – Ingo Feb 14 '18 at 22:48

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.