If like me, after a long week at work, you find yourself typing in a ubuntu terminal:
sudo chown mail /[I’ll explain why later]
Then you are in for a whole heap of trouble, because, inexplicably, sudo now does not work, instead, it complains about /var/run/sudo not owned by uid 0 (root), but by uid 8, which I presume to be the user mail.
By the way, all contents of folder ‘var’ is now under the dominion of the unholy ‘mail’ user.
Worst, you can’t use sudo to magically set our good friend root where it belongs.
I racked my brains for ways to make sudo work, from using a different file other than /var/run/sudo, to making sudo run as a different user other than root. None of them worked. I can’t run as root either…. or could I?
Then I realised, I can go into Ubuntu Recovery mode and it will give me terminal access as root.
chown -R root:root var/And my problem is solved!
ps. you want to know why i did that kamikaze command. There was a ‘mail’ folder that was locked, and i was trying to chown it to my user. Bad move!