This problem probably occurred after you ran the command below ( source ):
sudo chown -R 'whoami' 'npm -g bin'
When you use the chown
command with the -R
option, you tell the system to change the owner of files and group information recursively in their subdirectories and files. Which certainly affected sudo
.
To fix this you should reboot the system and go into recovery mode to reverse this process.
Fromthebootmenu,selectrecoverymode,itisusuallythesecondbootoption.
After selecting the recovery mode and waiting for all the boot processes, you will be shown a few options. In this case, you should initialize choosing to open a shell as root .
In recent versions of Ubuntu, the file system is mounted read-only, so you need to type the following command to reassemble as read and write, which will allow you to make changes:
mount -o rw,remount /
Once you have done this, you will be in the terminal as superuser, type:
# mount --all
# chown root:root /usr/bin/sudo
# chmod 4755 /usr/bin/sudo
After running the above commands, exit the session:
exit
This will take you back to the recovery menu.
Choose to resume a normal startup. You should then be able to use sudo
again.
Fonte