1

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?

3 Answers 3

2

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.

0
1

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!)

6
  • 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 Jul 4, 2011 at 17:24
  • 1
    It sounds like that would work, but how do i get recovery mode on the live cd? Jul 4, 2011 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. Jul 4, 2011 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. Jul 4, 2011 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. Jul 4, 2011 at 21:19
1

I think I have sorted it out using this command

pkexec chmod 0440 /etc/sudoers

I can now do

sudo -s
root@ubuntu:~#

Is this a good enough solution to the problem?

2
  • This will work..it worked for me Jan 5, 2021 at 5:35
  • I got Error getting authority: Error initializing authority: Could not connect: No such file or directory
    – temo
    Mar 25, 2022 at 8:25

You must log in to answer this question.

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