I have just made a huge mistake by changing the owner of my /usr/bin
from root
to an ordinary user
. Whenever i try to execute $sudo chown root /usr/bin
this gives me :
chown: changing ownership of ‘/usr/bin/’: Operation not permitted
I have read many topics talking about this issue, which most of them give a solution in case you have already a backup image of your OS. Unfortunately I don't have any backup. Is there any solution then other than reinstalling Ubuntu from scratch.
Solution:- Get in to Ubuntu Recovery Console Start your computer and press and hold SHIFT key while booting. It will take you to the grub loader page as shown in image – 1.
Image 1
Select and enter Advanced options for Ubuntu and from there select the kernel named as recovery mode as shown in image – 2.
Image 2
select root – drop to root shell prompt as shown in image – 3
Image 3
Now the file system is read only to Remount to Read Write run below command
# mount -o remount,rw /
then need to change the ownership for sudo
# chown root:root /usr/bin/sudo
give permisson for sudo
# chmod 4755 /usr/bin/sudo
it’s done … let’s see by restarting the machine
# shutdown -r now
You should have your Sudo back by now....