Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting message "sudo: must be setuid root", but sudo IS already owned by root [closed]

Tags:

I'm trying to run sudo, and it's failing:

gregd@david $ sudo ls
sudo: must be setuid root
gregd@david $ which sudo
/usr/bin/sudo
gregd@david $ ll /usr/bin/sudo
-rwxr-xr-x 1 root root 165K 2012-05-16 00:25 /usr/bin/sudo*

Any suggestions on how to fix this?

like image 963
Greg Dougherty Avatar asked May 22 '13 01:05

Greg Dougherty


2 Answers

This problem is caused sometimes when the permissions of the file, /usr/bin/sudo get set to 777. If you do something like chmod -R 777 /usr/, you can do this. It effectively ruins sudo. Here is the solution if this is your problem, and the accepted answer doesn't work:

To fix:

Restart pc, press shift at boot menu.

This should bring up GNU GRUB (ie recovery mode) menu.

  • If this doesn't work, just restart mid boot and choose recovery mode when prompted on next launch.

Select the line which starts with Advanced options

Select the topmost version of the OS ending with ("recovery mode")

Press enter

In the following menu, go down to "Drop to root shell prompt"

Type the following:

mount -o remount,rw /

mount --all

chown root:root /usr/bin/sudo

chmod 4755 /usr/bin/sudo

restart

This should restore sudo privellages.

like image 91
Adam Avatar answered Sep 22 '22 07:09

Adam


You have to be able to log in as root, but if you can you can run this

chmod u+s /usr/bin/sudo

And fix the problem

like image 29
Greg Dougherty Avatar answered Sep 23 '22 07:09

Greg Dougherty