sudo: must be setuid root

2

1

I rented a server (ubuntu 12.04). They gave me a root user account.

Next, I went in and created a new user using:

# adduser <newusername>

And added a password.

The new user account works fine. I can SSH into that account with its username and password.

However, when I'm in my new user account, I can no longer use:

sudo

If I do something like:

sudo apt-get install build-essential

or something like:

sudo su

I get the message:

sudo: must be setuid root

Help?

(I'm aware of similar questions asked before, but couldn't find my solution there.)

thanks_in_advance

Posted 2013-10-15T20:49:46.013

Reputation: 295

1Normally /usr/bin/sudo should be owned by root and yes, the setuid bit must be set. Can you do a ls -l $(which sudo)? – noggerl – 2013-10-15T20:52:47.177

Thanks for helping. I did it, here's the output "-rwxr-xr-x 1 root root 69708 Jun 1 2012 /usr/bin/sudo" – thanks_in_advance – 2013-10-15T20:56:54.340

Just posted an answer. But please do me a favor: before you proceed with your server and maybe something nasty happens read a few tutorials about internet server security and linux administration basics, because setuid on the wrong executables can be very dangerous. – noggerl – 2013-10-15T21:03:46.730

Answers

2

I don't know why but the setuid bit on the sudo executable is not set, which is needed to work properly.

To set this just do a chmod u+s $(which sudo). The statement $(which sudo) finds the path where in the filesystem the sudo executable is found (normally /usr/bin/sudo), so the command expands to chmod u+s /usr/bin/sudo. For more details on special bits on Linux/Unix-Systems just look at Wikipedia

noggerl

Posted 2013-10-15T20:49:46.013

Reputation: 1 229

OK, we're may be making progress. I did that, and now when I try to sudo inside my username "username1", I get the following message: "username1 is not in the sudoers file. This incident will be reported." – thanks_in_advance – 2013-10-15T21:07:51.053

So please see here: https://www.google.de/#q=sudo+configuration because I've got the feeling that you're missing a lot of linux administration basics.

– noggerl – 2013-10-15T21:11:55.953

I definitely am. I'm a newbie at this. Problem is that littlest things in Linux admin are so vast, that they are intimidating. But thank you very much for this link, I'm going to explore sudo configuration. – thanks_in_advance – 2013-10-15T21:14:15.023