Wednesday, 24 October 2018

How to fix sudo after “chmod -R 777 /usr/bin”?

Today, by mistakenly, I set the 'sudo chmod -R 777' to my /usr/bin folder as a root user. After doing that, I found that , my sudo command was not working at all. After spending a couple (of) hours over google, finally I got the solution and here I am going to share with you.

In an attempt to set permissions for my local scripts(because as I told you ,I broke the sudo permission and changed ownership, by mistake ), and back the ownership of sudo to root , I followed the following steps:
Step 1: Switch to ubuntu recovery mode. If you are unaware of the process, you can refer an answer here: https://brajeshnotes.blogspot.com/2018/10/how-can-i-start-ubuntu-in-safe-mode.html
Step 2: Once in recovery mode, select root - Drop to root shell prompt

Step 3: Do the following commands.
mount -o remount,rw /
chown root:root /usr/bin/sudo
chmod 4755 /usr/bin/sudo
reboot
Note*: If after reboot , sudo comes up with the same three errors mention below :  

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.

Try this :
$ mount -o remount,rw /
$ chmod 644 /usr/lib/sudo/sudoers.so
reboot
Wait for your system to boot normally and you will see the ownership of sudo back to root.After doing these all steps, still you guys facing any problem, please leave your valuable comments here, I will try to answer my best.

Related Posts:

  • How to fix sudo after “chmod -R 777 /usr/bin”? Today, by mistakenly, I set the 'sudo chmod -R 777' to my /usr/bin folder as a root user. After doing that, I found that , my sudo command was not working at all. After spending a couple (of) hours over googl… Read More
  • How to Hide the contact form from home page and sidebar We can not hide the the recently launched Blogger Contact form permanently (if we do so, we can cant further use custom contact form on the any page), but these's awesome way to hide contact Form in the Blogger and also f… Read More
  • How can I start Ubuntu in Safe Mode? How can I start Ubuntu in Safe Mode? Well! Its very easy to start Ubuntu in SAFE MODE. Lets see how we can do this. To start Ubuntu into safe mode (Recovery Mode) hold down the left Shift key as well as  th… Read More
  • How to install Java 8 in Ubuntu/mint For installing java 8 in your system, you need to executes the following commands with sudo permission. sudo add-apt-repository ppa:webupd8team/java sudo apt update; sudo apt install oracle-java8-installer How to che… Read More
  • How To Install MySQL on Ubuntu 16.04 MySQL is an open-source database management system, commonly installed as part of the popular LAMP(Linux, Apache, MySQL, PHP/Python/Perl) stack. It uses a relational database and SQL (Structured Query Language) to manage its… Read More

5 comments:

  1. You Are Good man, Thank You Alot <3

    ReplyDelete
  2. After follow your instruction i have not able to start my system. It's show always booting process,Can you please suggest me, It's very urgent.

    ReplyDelete
    Replies
    1. Apologies for the delay response. What problem are you facing?

      Delete
  3. This comment has been removed by the author.

    ReplyDelete