Why doesn't root need the password to run “sudo” even when “NOPASSWD:ALL” isn't written in...

Multi tool use
Multi tool use












6
















This question already has an answer here:




  • Why can `root` run any command as any user without providing password?

    2 answers




In /etc/sudoers, there is always:



root    ALL=(ALL:ALL) ALL


However, the root user (with UID 0) doesn't need to enter password when they run sudo command.



For other users, a password is required unless their entry contains NOPASSWD or a previous authentication hasn't timed out:



user    ALL=(ALL:ALL) NOPASSWD:ALL
^^^^^^^^









share|improve this question















marked as duplicate by muru, roaima, msp9011, nwildner, Anthony Geoghegan 20 hours ago


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.



















  • This is a bit weird actually. Even though you'd usually use sudo to run commands as UID 0, and root is already UID 0 and there's nothing to gain by stopping them, sudo still requires the config line for root to be there. Without it, it tells even root to bugger off.

    – ilkkachu
    yesterday











  • Cause it is root. What would you gain running sudo as root? "Beyond Root"? "Who watch the Watchmen?"

    – nwildner
    21 hours ago
















6
















This question already has an answer here:




  • Why can `root` run any command as any user without providing password?

    2 answers




In /etc/sudoers, there is always:



root    ALL=(ALL:ALL) ALL


However, the root user (with UID 0) doesn't need to enter password when they run sudo command.



For other users, a password is required unless their entry contains NOPASSWD or a previous authentication hasn't timed out:



user    ALL=(ALL:ALL) NOPASSWD:ALL
^^^^^^^^









share|improve this question















marked as duplicate by muru, roaima, msp9011, nwildner, Anthony Geoghegan 20 hours ago


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.



















  • This is a bit weird actually. Even though you'd usually use sudo to run commands as UID 0, and root is already UID 0 and there's nothing to gain by stopping them, sudo still requires the config line for root to be there. Without it, it tells even root to bugger off.

    – ilkkachu
    yesterday











  • Cause it is root. What would you gain running sudo as root? "Beyond Root"? "Who watch the Watchmen?"

    – nwildner
    21 hours ago














6












6








6


1







This question already has an answer here:




  • Why can `root` run any command as any user without providing password?

    2 answers




In /etc/sudoers, there is always:



root    ALL=(ALL:ALL) ALL


However, the root user (with UID 0) doesn't need to enter password when they run sudo command.



For other users, a password is required unless their entry contains NOPASSWD or a previous authentication hasn't timed out:



user    ALL=(ALL:ALL) NOPASSWD:ALL
^^^^^^^^









share|improve this question

















This question already has an answer here:




  • Why can `root` run any command as any user without providing password?

    2 answers




In /etc/sudoers, there is always:



root    ALL=(ALL:ALL) ALL


However, the root user (with UID 0) doesn't need to enter password when they run sudo command.



For other users, a password is required unless their entry contains NOPASSWD or a previous authentication hasn't timed out:



user    ALL=(ALL:ALL) NOPASSWD:ALL
^^^^^^^^




This question already has an answer here:




  • Why can `root` run any command as any user without providing password?

    2 answers








linux sudo root






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited yesterday







iBug

















asked yesterday









iBugiBug

1,0181031




1,0181031




marked as duplicate by muru, roaima, msp9011, nwildner, Anthony Geoghegan 20 hours ago


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.









marked as duplicate by muru, roaima, msp9011, nwildner, Anthony Geoghegan 20 hours ago


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.















  • This is a bit weird actually. Even though you'd usually use sudo to run commands as UID 0, and root is already UID 0 and there's nothing to gain by stopping them, sudo still requires the config line for root to be there. Without it, it tells even root to bugger off.

    – ilkkachu
    yesterday











  • Cause it is root. What would you gain running sudo as root? "Beyond Root"? "Who watch the Watchmen?"

    – nwildner
    21 hours ago



















  • This is a bit weird actually. Even though you'd usually use sudo to run commands as UID 0, and root is already UID 0 and there's nothing to gain by stopping them, sudo still requires the config line for root to be there. Without it, it tells even root to bugger off.

    – ilkkachu
    yesterday











  • Cause it is root. What would you gain running sudo as root? "Beyond Root"? "Who watch the Watchmen?"

    – nwildner
    21 hours ago

















This is a bit weird actually. Even though you'd usually use sudo to run commands as UID 0, and root is already UID 0 and there's nothing to gain by stopping them, sudo still requires the config line for root to be there. Without it, it tells even root to bugger off.

– ilkkachu
yesterday





This is a bit weird actually. Even though you'd usually use sudo to run commands as UID 0, and root is already UID 0 and there's nothing to gain by stopping them, sudo still requires the config line for root to be there. Without it, it tells even root to bugger off.

– ilkkachu
yesterday













Cause it is root. What would you gain running sudo as root? "Beyond Root"? "Who watch the Watchmen?"

– nwildner
21 hours ago





Cause it is root. What would you gain running sudo as root? "Beyond Root"? "Who watch the Watchmen?"

– nwildner
21 hours ago










2 Answers
2






active

oldest

votes


















6














sudo allows users to execute commands as UID 0 (or other users) based on how it’s configured. There is no need to ask root for a password to run a command as UID 0, because it already is UID 0.



Furthermore, root can also su to anyone it’d like, so there’s no need to prompt for a password when executing sudo -u user as UID 0.



Note: I do believe there is a PAM setting that will even require root to provide a password for the target user when using su.






share|improve this answer































    3














    While this is an interesting inconsistency. It would be pointless in stopping root, as root has capabilities CAP_SETUID and CAP_SETGID, so does not need sudo. It can do what ever it want.



    If sudo is checking root, and not these capabilities, then there may be a latent-bug: root with no capabilities could escalate (I don't know I have not looked at the code, or tested).






    share|improve this answer






























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      6














      sudo allows users to execute commands as UID 0 (or other users) based on how it’s configured. There is no need to ask root for a password to run a command as UID 0, because it already is UID 0.



      Furthermore, root can also su to anyone it’d like, so there’s no need to prompt for a password when executing sudo -u user as UID 0.



      Note: I do believe there is a PAM setting that will even require root to provide a password for the target user when using su.






      share|improve this answer




























        6














        sudo allows users to execute commands as UID 0 (or other users) based on how it’s configured. There is no need to ask root for a password to run a command as UID 0, because it already is UID 0.



        Furthermore, root can also su to anyone it’d like, so there’s no need to prompt for a password when executing sudo -u user as UID 0.



        Note: I do believe there is a PAM setting that will even require root to provide a password for the target user when using su.






        share|improve this answer


























          6












          6








          6







          sudo allows users to execute commands as UID 0 (or other users) based on how it’s configured. There is no need to ask root for a password to run a command as UID 0, because it already is UID 0.



          Furthermore, root can also su to anyone it’d like, so there’s no need to prompt for a password when executing sudo -u user as UID 0.



          Note: I do believe there is a PAM setting that will even require root to provide a password for the target user when using su.






          share|improve this answer













          sudo allows users to execute commands as UID 0 (or other users) based on how it’s configured. There is no need to ask root for a password to run a command as UID 0, because it already is UID 0.



          Furthermore, root can also su to anyone it’d like, so there’s no need to prompt for a password when executing sudo -u user as UID 0.



          Note: I do believe there is a PAM setting that will even require root to provide a password for the target user when using su.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered yesterday









          PeschkePeschke

          2,841926




          2,841926

























              3














              While this is an interesting inconsistency. It would be pointless in stopping root, as root has capabilities CAP_SETUID and CAP_SETGID, so does not need sudo. It can do what ever it want.



              If sudo is checking root, and not these capabilities, then there may be a latent-bug: root with no capabilities could escalate (I don't know I have not looked at the code, or tested).






              share|improve this answer




























                3














                While this is an interesting inconsistency. It would be pointless in stopping root, as root has capabilities CAP_SETUID and CAP_SETGID, so does not need sudo. It can do what ever it want.



                If sudo is checking root, and not these capabilities, then there may be a latent-bug: root with no capabilities could escalate (I don't know I have not looked at the code, or tested).






                share|improve this answer


























                  3












                  3








                  3







                  While this is an interesting inconsistency. It would be pointless in stopping root, as root has capabilities CAP_SETUID and CAP_SETGID, so does not need sudo. It can do what ever it want.



                  If sudo is checking root, and not these capabilities, then there may be a latent-bug: root with no capabilities could escalate (I don't know I have not looked at the code, or tested).






                  share|improve this answer













                  While this is an interesting inconsistency. It would be pointless in stopping root, as root has capabilities CAP_SETUID and CAP_SETGID, so does not need sudo. It can do what ever it want.



                  If sudo is checking root, and not these capabilities, then there may be a latent-bug: root with no capabilities could escalate (I don't know I have not looked at the code, or tested).







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered yesterday









                  ctrl-alt-delorctrl-alt-delor

                  12.1k42561




                  12.1k42561















                      lMZ38fHonn,VLiB2zk1qtVjfhcwAJ8K RsMR 5NH0,OikbXRp50Yl keMITAx AlhZsELfVi7wQ,xBZ
                      c0n5gs19xs Ek LD3736pnrJVqRTAQ3QE5HMipHGZQ iw 8E4x9SATjw

                      Popular posts from this blog

                      Bruad Bilen | Luke uk diar | NawigatsjuunCommonskategorii: BruadCommonskategorii: RunstükenWikiquote: Bruad

                      Færeyskur hestur Heimild | Tengill | Tilvísanir | LeiðsagnarvalRossið - síða um færeyska hrossið á færeyskuGott ár hjá færeyska hestinum

                      Chléb Obsah Etymologie | Pojmy při krájení bochníku nebo pecnu chleba | Receptura a druhy | Typy českého chleba | Kvalita chleba v České republice | Cena chleba | Konzumace | Postup výroby | Odkazy | Navigační menuDostupné onlineKdo si mastí kapsu na chlebu? Pekaři to nejsouVývoj spotřebitelských cen – Český statistický úřadDostupné onlineJak se co dělá: Chleba4008364-08669