It would be the right thing to say that I messed up!

Accidentally, I changed the owner of all files in /usr/bin to 'dev' from 'root'. Now, sudo does not work! If I use sudo with any command, I get -

sudo: effective uid is not 0, is sudo installed setuid root?

I cannot use chown command to change the owner back to 'root'. This is a major set back!

Because this is a Virtual Machine, I cannot access the Recovery Console. Infact, even the reboot command needs the user to have 'root' access.

Experts, please help me in getting control of the OS without having to re-image.


P.S - Possibly a duplicate but reposting as his solution was to start afresh.

More info -

su - root always says incorrect password. Unfortunately, the owner of su is also 'dev'.

I am able to create a new user using the GUI. It accepted the root password. How do I grant the new user with root access without using visudo.

  • Are you able to use vi ? – Sree May 19 '16 at 7:46
  • Yes @Sreeraj, I am able to use vi – Swanidhi May 19 '16 at 7:47
  • 1
    If you changed owner of su, then you're out of luck. What does which su says? – user140866 May 19 '16 at 8:09
  • @siblynx it says /bin/su. The owner of su is also 'dev' – Swanidhi May 19 '16 at 8:10
  • 1
    No it's not possible because only root can change privileged bits on executables. If anyone would, then system would be completely insecure. – user140866 May 19 '16 at 8:59

Physical security is security. You have three options:

  1. Log in as root, either from the console or by ssh.
  2. Boot in single-user mode, which traditionally doesn't need the root password (but might on your system).
  3. Mount the disk image from another OS.

Any of these will give you the ability to change the ownership of any file on the disk. If none of them is an option for you, you're out of luck, but you're also not in control: other things -- that aren't mistakes -- can happen that require console access.

  • Incidentally, checking root pw in single user is done in a way that doesn't care about suid binaries. – Joshua Aug 6 '19 at 20:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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