0

In ubuntu 11.04 I seem to have messed up the permissions/ownership of the /usr/ directory. It won't let me sudo -s to fix them!

sudo: must be setuid root

and I can't login as root because I'm on ubuntu and don't know the password. Does anybody have any advise? I also can't change the boot menu for the same reason.

1 Answer 1

2

Boot from a live CD and then either:

  • mount the root partition and ad setuid to sudo binary

mount /dev/sdxx /mnt
chmod +s /mnt/usr/bin/sudo
  • mount the root partition, chroot and change root password

mount /dev/sdxx /mnt
mount --bind /dev/ /mnt/dev/
chroot /mnt
passwd

Where /dev/sdxx is your root partition

3
  • 1
    Its the best answer but not quite what I wanted. Moral= always set the root password!
    – Mikhail
    Commented Jul 20, 2011 at 2:52
  • And/or, moral: don't mess with /usr.
    – tripleee
    Commented Oct 31, 2014 at 11:37
  • If you have run a stray chmod -R whatever then the only sane way to recover is to restore from backups or reinstall your system. Otherwise, you will be mired with lost or insecure privileges for quite some time to come.
    – tripleee
    Commented Oct 31, 2014 at 11:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .