Ubuntu /etc/sudoers problem

sshsudoUbuntu

Greetings

I am not able to add any users to the sudo users as my sudoers file has the wrong permission.
My only access is SSH thus this(via recovery mode) solution doesn't seem to work for me.

I will be grateful for any idea. My ubuntu is 9.04 server edition.

Regards

user@server:~$ sudo nano /etc/sudoers 
sudo: /etc/sudoers is mode 0640, should be 0440
Segmentation fault

user@server:~$ sudo chmod 0440 /etc/sudoers 
sudo: /etc/sudoers is mode 0640, should be 0440
Segmentation fault

Best Answer

You need to log in as root, because you will not be able to use sudo until you fixed it. If you have set a root password, type su and go ahead. If not, you need some kind of rescue system or the possibility to change the kernel parameters in grub.

Are you able to boot into a rescue system? Then mount your root filesystem somewhere and change the permissions of the file to 0440.

Are you able to change the kernel options? then add init=/bin/sh to it and boot. When the prompt appears, change your password like this:

# mount -o remount,rw /
# passwd
  [...]
# mount -o remount,ro /
# reboot

Then boot up your server and get root with su. Disable the root password afterwards

A third option would be to use security leaks in your system to become root. But I can't and don't want to help you there

Related Topic