Unable to use sudo command (Ubuntu 16.04.1 LTS) The 2019 Stack Overflow Developer Survey Results Are InMessed up visudo - can't edit the file anymoreI broke Sudo after an upgrade from 9 to 12.04.1How to get rid off - sudo: /usr/lib/sudo/sudoers.so must be only be writable by owner sudo: fatal error, unable to load pluginsHow to add my user account to admin group (13.10 desktop)Cannot chown or chmod using sudo anymoreHow to add flags and/or arguments to a command in the 'sudoers' filemessed up my /user directory permissions an now cannot run sudo or gksuEditing /etc/sudoers to allow Winbind Group members to Only sudo to 1 Local UserUbuntu Unity 16.10 'sudo: no tty present and no askpass program specified'Changed /etc ownership to my account now logged out of sudo?

"as much details as you can remember"

How do PCB vias affect signal quality?

Why not take a picture of a closer black hole?

Why was M87 targeted for the Event Horizon Telescope instead of Sagittarius A*?

Did Scotland spend $250,000 for the slogan "Welcome to Scotland"?

Is an up-to-date browser secure on an out-of-date OS?

How did passengers keep warm on sail ships?

How to charge AirPods to keep battery healthy?

What do hard-Brexiteers want with respect to the Irish border?

Why does the nucleus not repel itself?

If a sorcerer casts the Banishment spell on a PC while in Avernus, does the PC return to their home plane?

How much of the clove should I use when using big garlic heads?

Is it okay to consider publishing in my first year of PhD?

writing variables above the numbers in tikz picture

Can I have a signal generator on while it's not connected?

Why isn't the circumferential light around the M87 black hole's event horizon symmetric?

Why didn't the Event Horizon Telescope team mention Sagittarius A*?

APIPA and LAN Broadcast Domain

Is it correct to say the Neural Networks are an alternative way of performing Maximum Likelihood Estimation? if not, why?

What is the meaning of Triage in Cybersec world?

Star Trek - X-shaped Item on Regula/Orbital Office Starbases

How to display lines in a file like ls displays files in a directory?

For what reasons would an animal species NOT cross a *horizontal* land bridge?

What is the motivation for a law requiring 2 parties to consent for recording a conversation



Unable to use sudo command (Ubuntu 16.04.1 LTS)



The 2019 Stack Overflow Developer Survey Results Are InMessed up visudo - can't edit the file anymoreI broke Sudo after an upgrade from 9 to 12.04.1How to get rid off - sudo: /usr/lib/sudo/sudoers.so must be only be writable by owner sudo: fatal error, unable to load pluginsHow to add my user account to admin group (13.10 desktop)Cannot chown or chmod using sudo anymoreHow to add flags and/or arguments to a command in the 'sudoers' filemessed up my /user directory permissions an now cannot run sudo or gksuEditing /etc/sudoers to allow Winbind Group members to Only sudo to 1 Local UserUbuntu Unity 16.10 'sudo: no tty present and no askpass program specified'Changed /etc ownership to my account now logged out of sudo?



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








4















When I type sudo on terminal, I get:



sudo: unable to stat /etc/sudoers: Permission denied
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin


More info:



ls -ld / /etc /etc/sudoers
drwxr-xr-x 24 root root 4096 Dez 21 22:44 /
drw-rw-r-x 162 root root 12288 Jan 18 15:13 /etc
-r--r----- 1 root root 746 Jan 18 14:21 /etc/sudoers


pkexec visudo:



Defaults env_reset
Defaults mail_badpass
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

# User privilege specification
root 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









share|improve this question
























  • I don't know if it's significant but your /etc permissions look messed up - the default is drwxr-xr-x AFAIK (executable permission is needed in order to traverse directories).

    – steeldriver
    Jan 18 '17 at 18:27











  • @EliahKagan why don't you post an answer - since you've done the heavy lifting ;)

    – steeldriver
    Jan 18 '17 at 18:43











  • ... aaand upvoted

    – steeldriver
    Jan 18 '17 at 19:41

















4















When I type sudo on terminal, I get:



sudo: unable to stat /etc/sudoers: Permission denied
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin


More info:



ls -ld / /etc /etc/sudoers
drwxr-xr-x 24 root root 4096 Dez 21 22:44 /
drw-rw-r-x 162 root root 12288 Jan 18 15:13 /etc
-r--r----- 1 root root 746 Jan 18 14:21 /etc/sudoers


pkexec visudo:



Defaults env_reset
Defaults mail_badpass
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

# User privilege specification
root 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









share|improve this question
























  • I don't know if it's significant but your /etc permissions look messed up - the default is drwxr-xr-x AFAIK (executable permission is needed in order to traverse directories).

    – steeldriver
    Jan 18 '17 at 18:27











  • @EliahKagan why don't you post an answer - since you've done the heavy lifting ;)

    – steeldriver
    Jan 18 '17 at 18:43











  • ... aaand upvoted

    – steeldriver
    Jan 18 '17 at 19:41













4












4








4


1






When I type sudo on terminal, I get:



sudo: unable to stat /etc/sudoers: Permission denied
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin


More info:



ls -ld / /etc /etc/sudoers
drwxr-xr-x 24 root root 4096 Dez 21 22:44 /
drw-rw-r-x 162 root root 12288 Jan 18 15:13 /etc
-r--r----- 1 root root 746 Jan 18 14:21 /etc/sudoers


pkexec visudo:



Defaults env_reset
Defaults mail_badpass
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

# User privilege specification
root 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









share|improve this question
















When I type sudo on terminal, I get:



sudo: unable to stat /etc/sudoers: Permission denied
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin


More info:



ls -ld / /etc /etc/sudoers
drwxr-xr-x 24 root root 4096 Dez 21 22:44 /
drw-rw-r-x 162 root root 12288 Jan 18 15:13 /etc
-r--r----- 1 root root 746 Jan 18 14:21 /etc/sudoers


pkexec visudo:



Defaults env_reset
Defaults mail_badpass
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

# User privilege specification
root 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






permissions sudo






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 18 '17 at 18:23









steeldriver

70.7k11115187




70.7k11115187










asked Jan 18 '17 at 17:39









Felipe P.Felipe P.

23113




23113












  • I don't know if it's significant but your /etc permissions look messed up - the default is drwxr-xr-x AFAIK (executable permission is needed in order to traverse directories).

    – steeldriver
    Jan 18 '17 at 18:27











  • @EliahKagan why don't you post an answer - since you've done the heavy lifting ;)

    – steeldriver
    Jan 18 '17 at 18:43











  • ... aaand upvoted

    – steeldriver
    Jan 18 '17 at 19:41

















  • I don't know if it's significant but your /etc permissions look messed up - the default is drwxr-xr-x AFAIK (executable permission is needed in order to traverse directories).

    – steeldriver
    Jan 18 '17 at 18:27











  • @EliahKagan why don't you post an answer - since you've done the heavy lifting ;)

    – steeldriver
    Jan 18 '17 at 18:43











  • ... aaand upvoted

    – steeldriver
    Jan 18 '17 at 19:41
















I don't know if it's significant but your /etc permissions look messed up - the default is drwxr-xr-x AFAIK (executable permission is needed in order to traverse directories).

– steeldriver
Jan 18 '17 at 18:27





I don't know if it's significant but your /etc permissions look messed up - the default is drwxr-xr-x AFAIK (executable permission is needed in order to traverse directories).

– steeldriver
Jan 18 '17 at 18:27













@EliahKagan why don't you post an answer - since you've done the heavy lifting ;)

– steeldriver
Jan 18 '17 at 18:43





@EliahKagan why don't you post an answer - since you've done the heavy lifting ;)

– steeldriver
Jan 18 '17 at 18:43













... aaand upvoted

– steeldriver
Jan 18 '17 at 19:41





... aaand upvoted

– steeldriver
Jan 18 '17 at 19:41










1 Answer
1






active

oldest

votes


















3














Run pkexec chmod 755 /etc to fix this.



As steeldriver suggested, this error is because /etc has the wrong permissions. The permissions shown from ls -ld /etc should look like:



drwxr-xr-x


But yours look like:



drw-rw-r-x


This is preventing sudo from traversing /etc to access /etc/sudoers.



The "permission denied" error message just trying to retrieve metadata on (i.e., to stat) a file nearly always means the file is missing or directories leading to it cannot be traversed, and when you ran ls on the file, it was shown to exist.



I have tested this (on a virtual machine) by breaking permissions on /etc with chmod ug-x, and was able to produce your exact error message. (You shouldn't run chmod with ug-x on it -- that's how I deliberately broke the permissions, not how to fix them.)



To fix the permissions on /etc, give the user and group owners executable permissions. The absence of those permissions is the cause of this problem. In addition, by default /etc doesn't need the group owner to be given write permissions, so unless you know you want this, I recommend changing that back too.



This command will reset /etc to the default permissions:



pkexec chmod 755 /etc


That should work for you since you were able to run other commands as root with pkexec. Other users who find this by searching will usually be able to fix it the same way, but for systems without pkexec (or where pkexec will not work) it may be necessary to boot into recovery mode or from a live CD/DVD/USB to fix the permissions. You shouldn't need to do that, though. Just run that one simple command, and sudo should work again.






share|improve this answer

























    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "89"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f873430%2funable-to-use-sudo-command-ubuntu-16-04-1-lts%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    3














    Run pkexec chmod 755 /etc to fix this.



    As steeldriver suggested, this error is because /etc has the wrong permissions. The permissions shown from ls -ld /etc should look like:



    drwxr-xr-x


    But yours look like:



    drw-rw-r-x


    This is preventing sudo from traversing /etc to access /etc/sudoers.



    The "permission denied" error message just trying to retrieve metadata on (i.e., to stat) a file nearly always means the file is missing or directories leading to it cannot be traversed, and when you ran ls on the file, it was shown to exist.



    I have tested this (on a virtual machine) by breaking permissions on /etc with chmod ug-x, and was able to produce your exact error message. (You shouldn't run chmod with ug-x on it -- that's how I deliberately broke the permissions, not how to fix them.)



    To fix the permissions on /etc, give the user and group owners executable permissions. The absence of those permissions is the cause of this problem. In addition, by default /etc doesn't need the group owner to be given write permissions, so unless you know you want this, I recommend changing that back too.



    This command will reset /etc to the default permissions:



    pkexec chmod 755 /etc


    That should work for you since you were able to run other commands as root with pkexec. Other users who find this by searching will usually be able to fix it the same way, but for systems without pkexec (or where pkexec will not work) it may be necessary to boot into recovery mode or from a live CD/DVD/USB to fix the permissions. You shouldn't need to do that, though. Just run that one simple command, and sudo should work again.






    share|improve this answer





























      3














      Run pkexec chmod 755 /etc to fix this.



      As steeldriver suggested, this error is because /etc has the wrong permissions. The permissions shown from ls -ld /etc should look like:



      drwxr-xr-x


      But yours look like:



      drw-rw-r-x


      This is preventing sudo from traversing /etc to access /etc/sudoers.



      The "permission denied" error message just trying to retrieve metadata on (i.e., to stat) a file nearly always means the file is missing or directories leading to it cannot be traversed, and when you ran ls on the file, it was shown to exist.



      I have tested this (on a virtual machine) by breaking permissions on /etc with chmod ug-x, and was able to produce your exact error message. (You shouldn't run chmod with ug-x on it -- that's how I deliberately broke the permissions, not how to fix them.)



      To fix the permissions on /etc, give the user and group owners executable permissions. The absence of those permissions is the cause of this problem. In addition, by default /etc doesn't need the group owner to be given write permissions, so unless you know you want this, I recommend changing that back too.



      This command will reset /etc to the default permissions:



      pkexec chmod 755 /etc


      That should work for you since you were able to run other commands as root with pkexec. Other users who find this by searching will usually be able to fix it the same way, but for systems without pkexec (or where pkexec will not work) it may be necessary to boot into recovery mode or from a live CD/DVD/USB to fix the permissions. You shouldn't need to do that, though. Just run that one simple command, and sudo should work again.






      share|improve this answer



























        3












        3








        3







        Run pkexec chmod 755 /etc to fix this.



        As steeldriver suggested, this error is because /etc has the wrong permissions. The permissions shown from ls -ld /etc should look like:



        drwxr-xr-x


        But yours look like:



        drw-rw-r-x


        This is preventing sudo from traversing /etc to access /etc/sudoers.



        The "permission denied" error message just trying to retrieve metadata on (i.e., to stat) a file nearly always means the file is missing or directories leading to it cannot be traversed, and when you ran ls on the file, it was shown to exist.



        I have tested this (on a virtual machine) by breaking permissions on /etc with chmod ug-x, and was able to produce your exact error message. (You shouldn't run chmod with ug-x on it -- that's how I deliberately broke the permissions, not how to fix them.)



        To fix the permissions on /etc, give the user and group owners executable permissions. The absence of those permissions is the cause of this problem. In addition, by default /etc doesn't need the group owner to be given write permissions, so unless you know you want this, I recommend changing that back too.



        This command will reset /etc to the default permissions:



        pkexec chmod 755 /etc


        That should work for you since you were able to run other commands as root with pkexec. Other users who find this by searching will usually be able to fix it the same way, but for systems without pkexec (or where pkexec will not work) it may be necessary to boot into recovery mode or from a live CD/DVD/USB to fix the permissions. You shouldn't need to do that, though. Just run that one simple command, and sudo should work again.






        share|improve this answer















        Run pkexec chmod 755 /etc to fix this.



        As steeldriver suggested, this error is because /etc has the wrong permissions. The permissions shown from ls -ld /etc should look like:



        drwxr-xr-x


        But yours look like:



        drw-rw-r-x


        This is preventing sudo from traversing /etc to access /etc/sudoers.



        The "permission denied" error message just trying to retrieve metadata on (i.e., to stat) a file nearly always means the file is missing or directories leading to it cannot be traversed, and when you ran ls on the file, it was shown to exist.



        I have tested this (on a virtual machine) by breaking permissions on /etc with chmod ug-x, and was able to produce your exact error message. (You shouldn't run chmod with ug-x on it -- that's how I deliberately broke the permissions, not how to fix them.)



        To fix the permissions on /etc, give the user and group owners executable permissions. The absence of those permissions is the cause of this problem. In addition, by default /etc doesn't need the group owner to be given write permissions, so unless you know you want this, I recommend changing that back too.



        This command will reset /etc to the default permissions:



        pkexec chmod 755 /etc


        That should work for you since you were able to run other commands as root with pkexec. Other users who find this by searching will usually be able to fix it the same way, but for systems without pkexec (or where pkexec will not work) it may be necessary to boot into recovery mode or from a live CD/DVD/USB to fix the permissions. You shouldn't need to do that, though. Just run that one simple command, and sudo should work again.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Nov 20 '17 at 13:25

























        answered Jan 18 '17 at 19:08









        Eliah KaganEliah Kagan

        83.3k22229369




        83.3k22229369



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Ask Ubuntu!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f873430%2funable-to-use-sudo-command-ubuntu-16-04-1-lts%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Tamil (spriik) Luke uk diar | Nawigatjuun

            Align equal signs while including text over equalitiesAMS align: left aligned text/math plus multicolumn alignmentMultiple alignmentsAligning equations in multiple placesNumbering and aligning an equation with multiple columnsHow to align one equation with another multline equationUsing \ in environments inside the begintabularxNumber equations and preserving alignment of equal signsHow can I align equations to the left and to the right?Double equation alignment problem within align enviromentAligned within align: Why are they right-aligned?

            Where does the image of a data connector as a sharp metal spike originate from?Where does the concept of infected people turning into zombies only after death originate from?Where does the motif of a reanimated human head originate?Where did the notion that Dragons could speak originate?Where does the archetypal image of the 'Grey' alien come from?Where did the suffix '-Man' originate?Where does the notion of being injured or killed by an illusion originate?Where did the term “sophont” originate?Where does the trope of magic spells being driven by advanced technology originate from?Where did the term “the living impaired” originate?