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?

Ben Harold
  • 143
  • 1
  • 2
  • 9

1 Answers1

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
Anubioz
  • 3,597
  • 17
  • 23