Sudo permissions mixed up
I was messing with ubuntu trying to make autogen.sh work and did a dumb thing. I typed:
sudo chown -R emilia /usr/bin/
and after that I cannot use sudo anymore.
I tried so far:
logging as root and typing:
chown root:root /usr/bin/sudo && chmod 4755 /usr/bin/sudo
Didn't help.
I ran some tests and here are the results:
emilia@emilia:~$ ls -la /usr/bin | grep -v "root *root"
total 147656
drwxr-xr-x 2 emilia root 65536 Aug 14 16:06 .
-rwxr-xr-x 1 emilia root 51920 Feb 18 14:37 [
lrwxrwxrwx 1 emilia root 8 Aug 7 16:04 2to3 -> 2to3-2.7
-rwxr-xr-x 1 emilia root 96 Jul 2 21:02 2to3-2.7
emilia@tenshi:~$ ls -la /usr/bin | grep -v "rwxr-xr-x\|^l"
total 147656
-rwxrwxr-x 1 emilia emilia 22 Aug 14 16:06 autogen.sh
emilia@emilia:~$ ls -l /usr/bin/sudo
-rwxr-xr-x 1 emilia root 136808 Maj 4 19:25 /usr/bin/sudo
Solution 1:
Since you cannot use sudo
anymore, there are two things you can do:
If you have placed a root password (not your user password), use
su
on a terminal and you will be able to use the root account by using that password.If you haven't placed a root password, you can reboot your system and go to Recovery mode, and open a root session. Since you haven't placed a root password you won't be asked to enter one. After that, type:
mount -o rw,remount /
and press Enter to enable read/write access to your system.
Having gained root access by either of the methods above, issue chown -R root:root /usr/bin
and you should be back to business.
Solution 2:
Your commands are not working because recovery mode mounts the file system as read-only. To make it writable, run this command:
mount -o rw,remount /
Now, execute:
chmod 4755 /usr/bin/sudo
chown -R root:root /usr/bin
to fix the permissions.