Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I screwed up big time. I changed the permission of /etc in ubuntu 11.10 by using following command

sudo chmod 665 /etc

now when ever i try to use sudo it gives the following error:

sudo: can't open /etc/sudoers: Permission denied
sudo: no valid sudoers sources found, quitting

Any help will be greatly appreciated because i am new to Ubuntu. I have already tried using su but it doesnt even login as root and even i give it the right password it always say Authentication Failure. I don't want to login as root coz its risky and even a newbie in Linux like me is not stupid enough to have such control. I just want to use my sudo again. I have tried to go into recovery mode as well but I can't get in to recovery mode.

share|improve this question
add comment

5 Answers

Boot the recovery console option.
Select remount read-write
Select root shell
cd /
chmod 755 etc <--to get it back to default
sync
init 6

share|improve this answer
    
i dont know how to boot the recovery console option....i am really sorry but could you give me some hints on how to do it...i.e. boot the recovery console option? –  GuruDevil Mar 23 '12 at 11:42
1  
You got the arguments the wrong way around there. chmod 755 /etc –  geirha Mar 23 '12 at 11:49
    
Thanks. Fixed.... –  hbdgaf Mar 23 '12 at 11:51
    
thanx for the help......my problem is fixed.....happy coding –  GuruDevil Mar 23 '12 at 13:36
add comment

You can generally fix this sort of problem without booting into recovery mode, without using a live CD, and without rebooting at all. An Ubuntu system with a GUI (as opposed to an Ubuntu Server system with no GUI installed) has two mechanisms for running commands as root. One is sudo. The other is PolicyKit. You can use pkexec, the command-line frontend to PolicyKit, to fix the permissions:

pkexec chmod 755 /etc

If all you did to create the problem was to run sudo chmod 665 /etc, then that completely fixes the problem and you don't need to try to repair any permissions inside /etc. (Nothing inside /etc is changed with a chmod command on /etc that doesn't use the -R flag.)

share|improve this answer
    
+1 for pkexec: surely the most easy and quick way to solve the problem. –  Andrea Corbellini Jan 12 '13 at 9:21
add comment

Try inserting the the ubuntu live cd, open up the terminal and enter

  1. sudo su -
  2. mount /dev/sda5 (or whichever is the root partition of your Ubuntu installation) /mnt
  3. chroot /mnt
  4. chmod 755 /etc
  5. exit

This should make things as they were.

share|improve this answer
add comment

You need to chmod 440 /etc/sudoers. Try to do this in rescue mode or pass init=/bin/bash to boot command line. Ask if you need more info.

share|improve this answer
    
well to be honest i dont know how to go in rescue mode.....i know this is a stupid question but please tell me how to go in rescue mode.....boot menu shows 2 options only Windows7 ubuntu –  GuruDevil Mar 23 '12 at 11:41
    
Try liveCD. Anyway, to run sudo you need to chmod 440 /etc/sudoers. –  brownian Mar 23 '12 at 14:42
add comment

your boot-manager-OS-List looks like the windows-bootmanager, not the ubuntu-grub-bootmanager, which would give you the option to get into recovery mode.

i don't actually know if the system installs grub anywhere anyway, but when you select ubuntu try holding shift to get into the grub-menu (if existent).

Another way would be to edit the boot.ini-file on your windows-partition. There should be an entry for ubuntu. Try appending an 1 to this line and boot into ubuntu. The 1 ends you up in single-user-mode - a command line with root-access to your system.

But the easiest way is a life-CD for sure!!!

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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