0

When I tried to run sudo command the following error shows up:

sudo: /etc/sudoers is world writable

sudo: no valid sudoers sources found, quitting

sudo: unable to initialize policy plugin

I also tried 'pkexec chmod 555 /etc/sudoers' but it showed the following error: Error getting authority: Error initializing authority: Could not connect: No such file or directory

Is there a way to get back to normalcy without reinstallation?

I tried explorer.exe . in wsl and it shows all the ubuntu files in windows so can i change file permissions from Windows? Please Help...

1
  • FWIW: Manipulating the permission bits of important files, as is /etc/sudoers, has a tendency to cause trouble. Restore with chmod 440 /etc/sudoers for this particular file under Ubuntu (WSL is a modified Ubuntu).
    – Hannu
    Commented Jun 13, 2022 at 19:37

2 Answers 2

2

Open window cmd run as admin. Then wsl -u root, Here you can reset all permissions

chmod 555 /etc/sudoers
chmod 555 /etc/sudoers.d/README

Now you can open linux terminal in wsl sudo will work.

1

Based on my recent question, you can use wsl -u root from the Windows command prompt to enter into root mode (bypassing sudo). Then you can run the normal chmod command on /etc/sudoers to reset your permissions. In my case, I had deleted my sudoers file, but the same wsl command allowed me to create a new file and get back into my wsl with sudo working again.

You must log in to answer this question.

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