sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set [OSX]












0















So i was in teamviewer with my newbie developer who was trying to install some node js packages, npm install. he was having some issues with some libraries, he changed the permission of my mac sudo.



All the solutions I'm searching online are mostly related to ubuntu where they are suggesting this 1. Log out as the current user, then log back in as root. 2. Execute chown root:root /usr/bin/sudo && chmod 4755 /usr/bin/sudo 3. Log out as root, then log back in as the current user.



which simply doesn't work in mac. any solution other than re-installing?










share|improve this question



























    0















    So i was in teamviewer with my newbie developer who was trying to install some node js packages, npm install. he was having some issues with some libraries, he changed the permission of my mac sudo.



    All the solutions I'm searching online are mostly related to ubuntu where they are suggesting this 1. Log out as the current user, then log back in as root. 2. Execute chown root:root /usr/bin/sudo && chmod 4755 /usr/bin/sudo 3. Log out as root, then log back in as the current user.



    which simply doesn't work in mac. any solution other than re-installing?










    share|improve this question

























      0












      0








      0








      So i was in teamviewer with my newbie developer who was trying to install some node js packages, npm install. he was having some issues with some libraries, he changed the permission of my mac sudo.



      All the solutions I'm searching online are mostly related to ubuntu where they are suggesting this 1. Log out as the current user, then log back in as root. 2. Execute chown root:root /usr/bin/sudo && chmod 4755 /usr/bin/sudo 3. Log out as root, then log back in as the current user.



      which simply doesn't work in mac. any solution other than re-installing?










      share|improve this question














      So i was in teamviewer with my newbie developer who was trying to install some node js packages, npm install. he was having some issues with some libraries, he changed the permission of my mac sudo.



      All the solutions I'm searching online are mostly related to ubuntu where they are suggesting this 1. Log out as the current user, then log back in as root. 2. Execute chown root:root /usr/bin/sudo && chmod 4755 /usr/bin/sudo 3. Log out as root, then log back in as the current user.



      which simply doesn't work in mac. any solution other than re-installing?







      macos






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Sep 8 '17 at 23:37









      TestDjayTestDjay

      11




      11






















          1 Answer
          1






          active

          oldest

          votes


















          1














          Did you disable system integrity protection? If enabled, it's should've prevented you from messing with /usr/bin/sudo (and will also prevent fixing it except by reinstalling). I strongly recommend leaving SIP turned on; I can't think of any good reason you'd need to bypass it for a node.js setup (and plenty of bad reasons). You'll need to have it off to fix /usr/bin/sudo (and undo any other normally-forbidden changes you made), but I recommend turning it back on after you fix that.



          You should be able to fix sudo with /Applications/Utilities/Script Editor.app. Create a new "document" (script), and enter this:



          do shell script "chown root:wheel /usr/bin/sudo; chmod 4511 /usr/bin/sudo" with administrator privileges


          ...then click Run in the toolbar. It'll prompt for your admin password, and (if all goes well) will set the ownership and permissions back to normal.






          share|improve this answer
























          • i guess it didn't work

            – TestDjay
            Sep 9 '17 at 7:35











          • @TestDjay Did it give any error message? Do you know if system integrity protection is on or off? What does ls -leO /usr/bin/sudo show after running the AppleScript?

            – Gordon Davisson
            Sep 10 '17 at 7:57













          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "3"
          };
          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%2fsuperuser.com%2fquestions%2f1248720%2fsudo-usr-bin-sudo-must-be-owned-by-uid-0-and-have-the-setuid-bit-set-osx%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









          1














          Did you disable system integrity protection? If enabled, it's should've prevented you from messing with /usr/bin/sudo (and will also prevent fixing it except by reinstalling). I strongly recommend leaving SIP turned on; I can't think of any good reason you'd need to bypass it for a node.js setup (and plenty of bad reasons). You'll need to have it off to fix /usr/bin/sudo (and undo any other normally-forbidden changes you made), but I recommend turning it back on after you fix that.



          You should be able to fix sudo with /Applications/Utilities/Script Editor.app. Create a new "document" (script), and enter this:



          do shell script "chown root:wheel /usr/bin/sudo; chmod 4511 /usr/bin/sudo" with administrator privileges


          ...then click Run in the toolbar. It'll prompt for your admin password, and (if all goes well) will set the ownership and permissions back to normal.






          share|improve this answer
























          • i guess it didn't work

            – TestDjay
            Sep 9 '17 at 7:35











          • @TestDjay Did it give any error message? Do you know if system integrity protection is on or off? What does ls -leO /usr/bin/sudo show after running the AppleScript?

            – Gordon Davisson
            Sep 10 '17 at 7:57


















          1














          Did you disable system integrity protection? If enabled, it's should've prevented you from messing with /usr/bin/sudo (and will also prevent fixing it except by reinstalling). I strongly recommend leaving SIP turned on; I can't think of any good reason you'd need to bypass it for a node.js setup (and plenty of bad reasons). You'll need to have it off to fix /usr/bin/sudo (and undo any other normally-forbidden changes you made), but I recommend turning it back on after you fix that.



          You should be able to fix sudo with /Applications/Utilities/Script Editor.app. Create a new "document" (script), and enter this:



          do shell script "chown root:wheel /usr/bin/sudo; chmod 4511 /usr/bin/sudo" with administrator privileges


          ...then click Run in the toolbar. It'll prompt for your admin password, and (if all goes well) will set the ownership and permissions back to normal.






          share|improve this answer
























          • i guess it didn't work

            – TestDjay
            Sep 9 '17 at 7:35











          • @TestDjay Did it give any error message? Do you know if system integrity protection is on or off? What does ls -leO /usr/bin/sudo show after running the AppleScript?

            – Gordon Davisson
            Sep 10 '17 at 7:57
















          1












          1








          1







          Did you disable system integrity protection? If enabled, it's should've prevented you from messing with /usr/bin/sudo (and will also prevent fixing it except by reinstalling). I strongly recommend leaving SIP turned on; I can't think of any good reason you'd need to bypass it for a node.js setup (and plenty of bad reasons). You'll need to have it off to fix /usr/bin/sudo (and undo any other normally-forbidden changes you made), but I recommend turning it back on after you fix that.



          You should be able to fix sudo with /Applications/Utilities/Script Editor.app. Create a new "document" (script), and enter this:



          do shell script "chown root:wheel /usr/bin/sudo; chmod 4511 /usr/bin/sudo" with administrator privileges


          ...then click Run in the toolbar. It'll prompt for your admin password, and (if all goes well) will set the ownership and permissions back to normal.






          share|improve this answer













          Did you disable system integrity protection? If enabled, it's should've prevented you from messing with /usr/bin/sudo (and will also prevent fixing it except by reinstalling). I strongly recommend leaving SIP turned on; I can't think of any good reason you'd need to bypass it for a node.js setup (and plenty of bad reasons). You'll need to have it off to fix /usr/bin/sudo (and undo any other normally-forbidden changes you made), but I recommend turning it back on after you fix that.



          You should be able to fix sudo with /Applications/Utilities/Script Editor.app. Create a new "document" (script), and enter this:



          do shell script "chown root:wheel /usr/bin/sudo; chmod 4511 /usr/bin/sudo" with administrator privileges


          ...then click Run in the toolbar. It'll prompt for your admin password, and (if all goes well) will set the ownership and permissions back to normal.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Sep 9 '17 at 1:37









          Gordon DavissonGordon Davisson

          25.6k44350




          25.6k44350













          • i guess it didn't work

            – TestDjay
            Sep 9 '17 at 7:35











          • @TestDjay Did it give any error message? Do you know if system integrity protection is on or off? What does ls -leO /usr/bin/sudo show after running the AppleScript?

            – Gordon Davisson
            Sep 10 '17 at 7:57





















          • i guess it didn't work

            – TestDjay
            Sep 9 '17 at 7:35











          • @TestDjay Did it give any error message? Do you know if system integrity protection is on or off? What does ls -leO /usr/bin/sudo show after running the AppleScript?

            – Gordon Davisson
            Sep 10 '17 at 7:57



















          i guess it didn't work

          – TestDjay
          Sep 9 '17 at 7:35





          i guess it didn't work

          – TestDjay
          Sep 9 '17 at 7:35













          @TestDjay Did it give any error message? Do you know if system integrity protection is on or off? What does ls -leO /usr/bin/sudo show after running the AppleScript?

          – Gordon Davisson
          Sep 10 '17 at 7:57







          @TestDjay Did it give any error message? Do you know if system integrity protection is on or off? What does ls -leO /usr/bin/sudo show after running the AppleScript?

          – Gordon Davisson
          Sep 10 '17 at 7:57




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Super User!


          • 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%2fsuperuser.com%2fquestions%2f1248720%2fsudo-usr-bin-sudo-must-be-owned-by-uid-0-and-have-the-setuid-bit-set-osx%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

          Plaza Victoria

          Brian Clough

          Cáceres