Quantcast
Channel: Active questions tagged windows-subsystem-for-linux - Ask Ubuntu
Viewing all articles
Browse latest Browse all 2795

Can't change the owner back to the root (can't use sudo command) in WSL Ubuntu

$
0
0

I faced this issue when I want to use sudo command :

sudo: /etc/sudoers is owned by uid 1000, should be 0sudo: no valid sudoers sources found, quittingsudo: unable to initialize policy plugin

then I tried a solution from a similar question in order to change the owner back to the root:

$ pkexec visudo

also I tried this one

$ pkexec chown root:root /etc/sudoers /etc/sudoers.d -R

but I have faced another issue with these commands:

Error getting authority: Error initializing authority: Could not connect: No such file or directory

So is there a solution to this issue?


Full shell issue snippets:

ubuntu@LAPTOP-D4T16P7J:~$ sudo -isudo: /etc/sudoers is owned by uid 1000, should be 0sudo: no valid sudoers sources found, quittingsudo: unable to initialize policy pluginubuntu@LAPTOP-D4T16P7J:~$ pkexec visudoError getting authority: Error initializing authority: Could not connect: No such file or directoryubuntu@LAPTOP-D4T16P7J:~$ pkexec chown root:root /etc/sudoers /etc/sudoers.d -RError getting authority: Error initializing authority: Could not connect: No such file or directory


This is my /etc/sudoers file:

ubuntu@LAPTOP-D4T16P7J:~$ cat /etc/sudoers## This file MUST be edited with the 'visudo' command as root.## Please consider adding local content in /etc/sudoers.d/ instead of# directly modifying this file.## See the man page for details on how to write a sudoers file.#Defaults        env_resetDefaults        mail_badpassDefaults        secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"# Host alias specification# User alias specification# Cmnd alias specification# User privilege specificationroot    ALL=(ALL:ALL) ALL# Members of the admin group may gain root privileges%admin ALL=(ALL) ALL# Allow members of group sudo to execute any command%sudo   ALL=(ALL:ALL) ALL# See sudoers(5) for more information on "#include" directives:#includedir /etc/sudoers.d


OS info:

  • Ubuntu WSL2.

Viewing all articles
Browse latest Browse all 2795

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>