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
Two methods:
Early in the boot process, escape to the bootloader menu, and append the following to the kernel command-line:
singleFor 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,rwIf
singledoesn'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
rooptions)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,
mountthe filesystem which hasetc/sudoerson it (with-o loopif necessary), and usesudo 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.
I'm not sure if recent Ubuntus have root user enabled by default, but you could try
su rootto 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!)
6I think I have sorted it out using this command
pkexec chmod 0440 /etc/sudoersI can now do
sudo -s
root@ubuntu:~#Is this a good enough solution to the problem?
2