Sudo broken on Ubuntu linux

I get this when I try to do something as sudo.
sudo: must be setuid root

following some advice I went into recovery mode, and from command line as root
I tried:

chmod 4111 /usr/bin/sudo

and I could not do this, it said its a read only file system.

How can I get sudo back?
claghornAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

claghornAuthor Commented:
Just an update. I did manage to log in as a single user. root.
from there I saw that the permissions on /usr/bin/sudo is:
---x--x--x 2 root root

How do I make it ---s--x--x 2 root root?

This all started by the way because I was all of a sudden getting the message while doing something as sudo:

/etc/sudoers is owned by uid 1000, should be 0

I tried to fix that and thats why I'm here.

1000 is me though? I don't know how this happened to be honest.
Darr247Commented:
If you boot into recovery mode, I believe you have to remount your hard drive installation before you can make any changes to it.
e.g.
# mount -o remount,rw /
the 'rw' makes it writeable, too.
claghornAuthor Commented:
Can you type the command I need.? I tried so many combinations of the above command but none have worked.
Become a Microsoft Certified Solutions Expert

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

claghornAuthor Commented:
# mount -o remount,rw '/usr/bin/sudo'

and I get:

mount can't find '/usr/bin/sudo' in /etc/fstab or /etc/mtab
Darr247Commented:
So, what do you get from
# mount -o remount,rw /
?

How about the output from
$ cat /etc/fstab
?
claghornAuthor Commented:
# mount -o remount,rw /

gives no message and I enter the commands:

chmod 4111 /usr/bin/sudo
chown root:root /usr/bin/sudo

no message. ok so it worked?

but when I enter ls -l /usr/bin/sudo

I see:
---x--x--x 2 root root
not:
---s--x--x 2 root root (which is what I should see?)

when I go back and log in as normal and try something as sudo I get:

sudo: must be setuid root

So I think your advice so far has not worked. Thanks for help. Can you suggest some more things to try?
claghornAuthor Commented:
btw,

ls -l /etc/sudoers

returns:

-r--r----- 1 root root 723 Jan 31  2012 /etc/sudoers
Darr247Commented:
How about the output from
$ cat /etc/fstab
?

Sanitize it if you think there's something private there (like, xxxx out passwords, et cetera).
claghornAuthor Commented:
ok, sorry to be a moving target but I ran:

chmod +s root /usr/bin/sudo

Then I saw that the permissions changed to the
---s--s--x 2 root root (that I was looking for)
Now sudo works again but I get the annoying message:

sudo: /etc/sudoers.d/README is owned by uid 1000, should be 0

This is what started happening in the very beginning.
Do you know how to get rid of that?

cat /etc/fstab returns:

# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    nodev,noexec,nosuid 0       0
# / was on /dev/sda1 during installation
UUID=xxxx /               ext4    errors=remount-ro 0       1
# swap was on /dev/sda5 during installation
UUID=xxxx none            swap    sw              0       0


It would be nice to use su but when I try I get:
Password:
su: Authentication failure

I think this means su has no password. If I give it one. Then I can avoid this lengthy rebooting all the time.
Darr247Commented:
su wants the root password, whereas sudo only needs the sudo user's password.

But to change the owner of a file, use
$ sudo chown owner:group /path/to/filename
owner and group can be the names or UIDs.

If you want to make the owner:group match another file's owner:group, use
$ sudo chown --reference=/path/to/otherfilename /path/to/filename

So you should be able to fix that message with
$ sudo chown 0:0 /etc/sudoers.d/README

And, of course,
$ man chown
gives all the options.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
claghornAuthor Commented:
sudo chown 0:0 /etc/sudoers.d/README

The above worked. Thanks.

I am about to set the root's password because I want to use su.
I get prompted but when I just hit enter (since there is no root password set) I still get authentication error message.

I want to make sure sudo does not break again after I do this. If it does not break and su works then I'll be finished. And I'll close this out. Thanks again.
claghornAuthor Commented:
Actually sudo -i
seems to work.
I will not set a password for root.
claghornAuthor Commented:
I did this to fix it:
chmod +s root /usr/bin/sudo

Then I saw that the permissions changed to the
---s--s--x 2 root root (that I was looking for)
Now sudo works again but I get the annoying message:

sudo: /etc/sudoers.d/README is owned by uid 1000, should be 0

Then your suggestion of worked even further:
sudo chown 0:0 /etc/sudoers.d/README
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux Distributions

From novice to tech pro — start learning today.