42.6 C
Wednesday, April 17, 2024
HomeLinuxsudo: /etc/sudoers is mode 0755, should be 0440

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

You may get below errors while you do Sudo.sudo: /etc/sudoers is mode 0755, should be 0440
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin
Steps to recover /etc/sudoers/Step 1 – Press ‘shift’ key to enter in to GRUB while system starts
Step 2 – Select linux (recovery mode) which is usually second boot option in GRUB Menu
Step 3 – After entering to recovery mode wait till the boot-up processes to finish, you’ll be presented with a few options. Use drop down key to select Drop to root shell prompt option and then press Enter to select it.
Step 4 – Enter this command to remount as read-write : mount -o rw,remount / press enter
Step 5 – Be careful what commands you are typing, as its the ultimate administrator can do anything to the ubuntu installation
Step 6 – Then enter this command – chmod 0440 /etc/sudoers
Step 7 – Now type Exit, else shutdown -r now to reboot

This is done and you will be able to sudo now.
In some cases if you confront with a new error like /etc/sudoers.d access denied or /etc/sudoers.d/README access denied
Same repeat step 1 to 3 to go to the Drop to root shell prompt
then remount with the command mount -o rw,remount / and type below these 3 commands one after another
chmod -R a+rx /etc/sudoers.d
chmod -R u+w /etc/sudoers.d
chmod 0440 /etc/sudoers.d/README

shutdown -r now

This will solve the problem.

On Another note when you stuck getting this error (/etc/sudoers syntax error near line 31/ line 17 etc)

Follow above the Steps – 1 to step – 3

then use Root Drop to root shell promt

type this command to give allow r/w operation mount -o rw,remount /

then type visudo -f /etc/sudoers

now shutdown -r now to restart and log in to normal boot

Now you should able to log in and use sudo as before

Durga Charan Ojhahttps://lifeonnetwork.com/
I am a proud Indian, proud father, a blogger, Being in a profession as System administrator, my passion is troubleshooting computer issues, I do like sharing solutions through blogging making videos of solving issues.


Please enter your comment!
Please enter your name here

Most Popular