Recently, we installed Ubuntu Server on our servers this is very new for us. However, we tried to setup a apache2 server which did work. But the problem is that we can't configure apache and other configure files due the lack of permissions. I found a command for some days ago and gave myself access to "/var/www". But that's the only folder I got permissions to. I forgot what the command was and I can't use root because I don't know the password. I can't remember if I tried to setup any. I am the only user on the machine so I got admin permissions but need root. So what I need help with is to give myself access to the whole server. Mostly "/etc/apache2" but the whole server would be better. Anyways, how do I give myself permissions for this and how do I enable root? All sudo commands tells me this " sudo: must be setuid root".


isn't sudo what you're looking for? In Ubuntu, when you want to get root privileges, you must run "sudo command"... or "sudo su" (there is also "sudo -s", and I think the difference is with environment variables, but I don't remember now) if you really want a root session. The password is your user password.

Try to check the owner of the directories... If I remember correctly, in ubuntu, apache creates a user and group of his own, and that only has access to it's own directories.

EDIT: I believe your only way to fix this is to boot with a Linux live disc and mount your Ubuntu file system there to fix the permissions and owner of the sudo binary (and maybe sudoers file). These commands should do it:

sudo chown root:root /mnt/yourfs/usr/bin/sudo
sudo chmod 4755 /mnt/yourfs/usr/bin/sudo
sudo chown root:root /mnt/yourfs/etc/sudoers
sudo chmod 440 /mnt/yourfs/etc/sudoers

The leading 4 in first chmod is to set the setuid special permission: http://docs.oracle.com/cd/E19683-01/816-4883/secfile-69/index.html

  • When I type "sudo -s" or "sudo su" it says sudo: must be setuid root. – Martin Jan 4 '14 at 22:37
  • Was this information originally on the topic? I need to visit my oftalmologist. hehe. Sorry for that. Googling for this error message I found a number of threads. Seems like the problem might be with the permissions of the sudo binary. But you would need to use a recovery/live disc to change that. Have you tried it? For reference: ubuntuforums.org/showthread.php?t=1930151 – GabrielF Jan 4 '14 at 23:05
  • Hmm, the only way to solve it is to use the recovery/live disc? I would have to ask the guy who hosts this for me. He doesn't understand how to use the disc and boot up. I would have to go and do it manually again then? – Martin Jan 4 '14 at 23:12
  • You should probably check if there's really something wrong with the sudo binary... "ls -l /usr/bin/sudo" should result in something like that: "-rwsr-xr-x 1 root root ..." (that's what it appears here). I believe the important part is the s permission. – GabrielF Jan 4 '14 at 23:20
  • It says -rwxr-xr-x 2 www-data www-data 69708 Feb 27 2013 /usr/bin/sudo – Martin Jan 10 '14 at 23:44

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.