Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have lubuntu installed with persistance on a large usb flash drive, and somehow, My /etc/sudoers file has file permissions 0664, when ever I try to use sudo, it says :

sudo: /etc/sudoers is mode 0644, should be 0440

sudo: no valid sudoers sources found, quitting

when I try chmod 0440 /etc/sudoers it says:

chmod: changing permissions of `/etc/sudoers': Operation not permitted

sudo chmod 0440 /etc/sudoers causes the first message. Am I using chmod incorrectly? How can I fix this? If you need to know, it is lubuntu 10.10, isntalled with unetbootin.

EDIT: I know how to fix it with recovery mode, i just need to know how to get into recovery mode in a live cd, is it possible?

share|improve this question
up vote 1 down vote accepted

Two methods:

  • Early in the boot process, escape to the bootloader menu, and append the following to the kernel command-line:

    single
    

    For Ubuntu, this will cause it to boot in the "recovery" mode, straight into a root shell.

    If chmod in the recovery console complains about a read-only filesystem, remount it read-only:

    mount / -o remount,rw
    

    If single doesn't work for some reason, another option is to skip the init process entirely, but this might not enable the persistent overlay.

    init=/bin/sh rw
    

    (deleting any existing ro options)

  • Alternatively, use another Linux computer which you have root access on – such as a real live CD (whether it's Ubuntu or not doesn't matter). Then plug in your drive, mount the filesystem which has etc/sudoers on it (with -o loop if necessary), and use sudo chmod.


Am I using chmod incorrectly?

The usage is correct, it's just that only the file's owner can change its permissions, and /etc/sudoers is normally owned by root – which you aren't.

share|improve this answer
    
Thanks, single user mode worked. – invisible bob Jul 6 '11 at 20:46

I'm not sure if recent Ubuntus have root user enabled by default, but you could try

su root

to get a root shell instead. If that doesn't work, this guide takes you through repairing sudo on Ubuntu (I haven't tried it myself!)

share|improve this answer
    
su root asks for a password, is that my password or the root password? ubuntu has a root account, but it has no password, and livecd ubuntu's account password ("") does not work. i will look at the guide – invisible bob Jul 4 '11 at 17:24
1  
It sounds like that would work, but how do i get recovery mode on the live cd? – invisible bob Jul 4 '11 at 17:29
2  
@invisible: The live CD itself is a form of "recovery mode" in that it bypasses the system's auth settings. While using the live CD, you can just use sudo -s or sudo chmod. – grawity Jul 4 '11 at 17:36
    
@grawity sudo chmod 0440 /etc/sudoers yields: sudo: /etc/sudoers is mode 0644, should be 0440 sudo: no valid sudoers sources found, quitting I am booting from the live cd, i have no ubuntu on my computer. – invisible bob Jul 4 '11 at 21:15
    
@invisible: It seems that you/we confused "live CD" with your USB-installed system. What you can do is boot a real live CD and proceed with recovery from there. – grawity Jul 4 '11 at 21:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .