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 install Google Chrome For installing Google Chrome in your Ubuntu system, you have need to follow some following steps. STEP 1 : Execute the following commands- cd /tmp wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.d… Read More
  • How To Install java 8 On Ubuntu 16.04 / 17.10 / 18.04 Today, from this post , I will try to show you, how we can install java 8 in   Ubuntu 16.04 / 17.10 / 18.04 environment. So lets start... For doing this you need to follow some steps these are as below:- Step 1: A… 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
  • How To Install VirtualBox 5.2 on Linux Mint 19 / Linux Mint 18 VirtualBox is an open-source hypervisor application that helps you create and run guest operating systems (“virtual machines”) such as Linux and Windows under a host operating system. VirtualBox can be installed on hos… Read More
  • 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

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