0

Title says it all. I was copy-paste troubleshooting and I accidentally changed the owner of sudo from root to my username. No I can't sudo because:

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

So I tried chown root: sudo but I was told:

chown: changing ownership of ‘sudo’: Operation not permitted

I can't mount -o rw,remount because:

mount: only root can use "--options" option

And obviously I can't sudo that last one.

Am I out of luck or is there any method by which I can get my sudo back?

2
  • Do you not have the existing root pw?
    – Aaron
    Aug 13, 2016 at 0:22
  • There is no root password.
    – Ben Harold
    Aug 13, 2016 at 0:37

1 Answer 1

1
  1. Boot your system from a LiveCD/USB
  2. Mount your system disk
  3. Go to /etc/shadow on your system disk
  4. Find the line, which starts with root
  5. Replace substring from the first semi-column to the second with $1$3HzHiOce$3cwQcLKHTqF3FcLTLAYxC0, so the result will be something like:root:$1$3HzHiOce$3cwQcLKHTqF3FcLTLAYxC0:16820:0:99999:7:::
  6. Delete the /etc/securetty file
  7. Reboot your system
  8. You will now be able to login as root with Password password

You must log in to answer this question.

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