Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I did it... I guess everyone does it sometime, but this was my first. I executed sudo chown -R /usr/bin and before I realized my mistake, it was too late... Now I can't access sudo because I receive the following error: sudo: must be setuid root. I would really appreciate if I could avoid a complete reinstall of ubuntu because that would require far too much work :(

Here is the commands I've tried without success (in recovery mode):

chown root:root /usr/bin/sudo
chmod 4755 /usr/bin/sudo

I've also tried chmod 0440 /etc/sudoers all without success. Any ideas about what I can try to fix it?

NOTE: Sorry for creating another one of these threads, but since I knew the exact command I executed to blow it all up, I thought that might make a difference :)

share|improve this question
    
I think you might want to try booting a live CD/USB and chooting into your existing installation to fix things... Just an idea. –  RobinJ May 5 '12 at 22:35
add comment

1 Answer

up vote 3 down vote accepted

Just use any live cd to boot into recovery and then select the hard disk and navigate to the bin folder of your installed ubuntu. Then reset the permissions like this: go to the root console. Once there, execute the following to return permissions back:

chmod 755 /bin\

EDIT: Just go to terminal from any live cd and write there:

sudo fdisk -l 

This will list out all the partitions. Just locate the root partition of the drive and write down its device name. It will have the device listed out in order:

/dev/sda1
/dev/sda2
/dev/sda3
....
....

Just note down the device name of your root partition, let you can use Gparted to examine the partitons in a better way. But finding out the root partition is what you all care about. Now suppose /sda2 is your root partition(I assume). Just go to terminal and mount the device by

sudo mkdir /mnt //in case live cd does not have /mnt folder.
sudo mount /dev/sda2

Now when you get your device mounted, Just navigate to it as:

sudo lshw 

and note down the root device serial number

cd /media
cd device-logical-number  // for ex- mine have A272B6CF72B6A785

and now you can cd to bin directory and can apply permission there.

share|improve this answer
    
I cannot use the recovery console for this? And if I may ask, with 'go to the root console' do you mean sudo su? EDIT: And I guess a USB would work just as fine? –  Elliott Darfink May 5 '12 at 23:10
    
yeah a usb or anything that can lead you to the terminal of live cd of ubuntu could be good. –  ashutosh May 5 '12 at 23:14
    
Just so I don't make any mistakes. Should I boot from the usb, cd to /bin (on my installed harddrive) and execute chmod 755 /bin\? And am I super user automatically or do I need to execute sudo su or something similiar? –  Elliott Darfink May 5 '12 at 23:27
    
yeah you got me. Just boot from the USB or CD and go to terminal and just access the drive on which you have ubuntu installed on and change the permission from there as the root. You need to be root to make the changes –  ashutosh May 5 '12 at 23:28
    
Writing from my phone. How do I cd into my hard drive/mount it? –  Elliott Darfink May 5 '12 at 23:35
show 3 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.