-1

(Accidental) Action

Hi, I am not very well versed in Linux but using Ubuntu for more than a year.

Couple of days back I accidentally changed the ownership of my root folder while changing ownership of another non-root directory. I am not sure but as far as I remember, I executed sudo chown -R root:root /bin accidentally.

The Consequences

Now I am unable to do anything that requires sudo. This is the error I am getting while performing any such task:

max@max-ThinkPad-T430:~/Desktop$ sudo chown -R root:root /bin sudo: /etc/sudoers is owned by uid 1000, should be 0 sudo: no valid sudoers sources found, quitting sudo: unable to initialize policy plugin

Question

What's the solution to bring back the sudo working exactly as it was before the incident.

Maax
  • 33
  • 1
  • 8
  • You do have a root password? – alk Jun 08 '14 at 13:50
  • Strange but true: my current password that I used to use with `sudo` is not working anymore for `su -` or `su root`. – Maax Jun 08 '14 at 16:43
  • The password you use for `sudo`'ing as ordinary user, is different from the password needed to do `su - `. The former is the user's password, the latter is the root password. – alk Jun 08 '14 at 16:53
  • If you have never logged in as root, if you do not have a root-password, the approach descibed in *Kaoru*'s answer is the way to go. Boot your system externally, mount the root-partition and fix the access rights. Alternativly you can `chroot` to the mounted partition and issue a `passwd root` to explicitly set a root password, which you then later after having booted your system from the original partition again can use to log in as root and fix everything as neded, without the sudo stuff. – alk Jun 08 '14 at 16:56
  • In any case: Such kind of questions are off-topic here andf shall better go to http://superuser.com ... – alk Jun 08 '14 at 16:59

1 Answers1

1

I would recommend creating a bootable disk (CD, DVD or USB Drive) using the "Startup Disk Creator" (/usr/bin/usb-creator-gtk) and a recent Ubuntu Desktop .iso file, available from http://www.ubuntu.com/download/desktop/.

Once you have created the startup disk, reboot your computer and ensure that you boot from the startup disk. I assume you know how to do that given that you have installed Ubuntu before.

Don't choose the "Install Ubuntu" mode, just use the "Try It Out" mode to get to a desktop environment. From there you should be able to mount your existing Ubuntu setup and chown root /etc/sudoers so that your sudo command will work again.

Reboot to your real Ubuntu installation and try sudo ls, it should work now.

Kaoru
  • 1,540
  • 11
  • 14