Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

This question already has an answer here:

I have given the wrong permission to the /etc folder

chmod -R 777 /etc

When I want to login as root it gives me an error and the following output.

How can I correct the permissions?

system13@motpl:~$ sudo su
sudo: /etc/sudoers is mode 0777, should be 0440
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin
system13@motpl:~$ su root
Password: 
su: Authentication failure
system13@motpl:~$ 
share|improve this question

marked as duplicate by Gilles May 15 at 23:15

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
If you don't manage to escalate privileges to root, boot into a root command line — see unix.stackexchange.com/questions/77852/… for tips. Or reinstall the system — recovering from bad permissions on /etc requires quite a bit of experience. –  Gilles May 15 at 23:18
    
@Gilles Yes thank you. And the answer given by me looks very simple. It worked. But i don't know whether it is good practise or not. –  Sulthan Allaudeen May 16 at 1:59

3 Answers 3

Seems like your root account does not have an associated password, hence you cannot log into your root account directly. The other way to get root is sudo which is currently broken due to the wrong permissions of the sudoers file.

Since you need root access to fix those permissions you need to find another way.

Maybe the easiest way is to add a custom init option to your kernel at bootup.

Your boot manager should allow you to add custom options to your kernel command line. Reboot your computer and add something like init=/bin/bash at the end of the kernel line.

Then your kernel should start bash instead of the normal init deamon. This way you can fix your permissions and after another reboot your usual sudo should work again.

share|improve this answer
    
I have a password. And another thing. I can do the init=/bin/bash only if i am root user right. Now i can't be a root user –  Sulthan Allaudeen May 15 at 6:09
1  
The init process is always run with root permissions. With this kernel option your kernel will directly boot into a root shell. –  michas May 15 at 6:11
    
After entering init=/bin/bash and pressing Ctrl+x it is rebooting but it is not entering with root mode. it is just like normal boot and can't use the sudo su too –  Sulthan Allaudeen May 15 at 6:24
up vote 0 down vote accepted

The problem was fixed by myself :

I typed pkexec chmod 0440 /etc/sudoers

And then i am able to be sudo su, and then the permission was changed and i gave the default permission /etc as chmod 744 /etc

share|improve this answer

its because of Limiting Access to sudo

Follow these steps:

chmod 755 /etc/sudoers

vi /etc/sudoers

Allow root to run any commands anywhere

root ALL=(ALL) ALL username ALL=(ALL) ALL

username = your username

type Esc > type :wq Enter

change chmod to

chmod 440 /etc/sudoers

Your problem is solved :)

share|improve this answer

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