Why is su world executable?using sudo on GUI applicationsHow to create an executable bash script for these commands?What exactly differentiates the root user from every other user?How to give users or group in linux sudo permission with limited permission on certain filesSSH + Change password using rootWhy is sudo required for every sudo executed executable?Why is /etc/sudoers not world-readable?

Problem with GFCI at start of circuit with both lights and two receptacles

Is this bar slide trick shown on Cheers real or a visual effect?

Output with the same length always

How do I answer an interview question about how to handle a hard deadline I won't be able to meet?

Why does this image of cyclocarbon look like a nonagon?

Does Medium Armor's Max dex also put a cap on the negative side?

What would cause a nuclear power plant to break down after 2000 years, but not sooner?

How to gracefully leave a company you helped start?

What's the point of writing that I know will never be used or read?

Resource is refusing to do a handover before leaving

Short comic about alien explorers visiting an abandoned world with giant statues that turn out to be alive but move very slowly

Why do aircraft leave cruising altitude long before landing just to circle?

Do I need to start off my book by describing the character's "normal world"?

Change the default Bookmarks Folder In Firefox

Will some rockets really collapse under their own weight?

Can I use my OWN published papers' images in my thesis without Copyright infringment

Has there ever been a truly bilingual country prior to the contemporary period?

Why does Japan use the same type of AC power outlet as the US?

How to train a replacement without them knowing?

Is the Microsoft recommendation to use C# properties applicable to game development?

When does The Truman Show take place?

Unconventional examples of mathematical modelling

Will Force.com stop working on salesforce Lightning?

What should we do with manuals from the 80s?



Why is su world executable?


using sudo on GUI applicationsHow to create an executable bash script for these commands?What exactly differentiates the root user from every other user?How to give users or group in linux sudo permission with limited permission on certain filesSSH + Change password using rootWhy is sudo required for every sudo executed executable?Why is /etc/sudoers not world-readable?






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








3















I have a headless server that is logged into remotely by multiple users. None of the other users are in the sudoers file, so they cannot obtain root via sudo. However, since the permissions on su are -rwsr-xr-x there's nothing stopping them from attempting to brute force the root password.



One could argue that if a user knows the root password they can compromise the system anyway, but I don't think this is the case. OpenSSH is configured with PermitRootLogin no and PasswordAuthentication no, and none of the other users have physical access to the server. As far as I can tell, the world execute permission on /usr/bin/su is the only avenue for users attempting to gain root on my server.



What's further puzzling to me in that it doesn't even seem useful. It allows me to run su directly instead of needing to do sudo su, but this is hardly an inconvenience.



Am I overlooking something? Is the world execute permission on su just there for historic reasons? Are there any downsides to removing that permission that I haven't encountered yet?










share|improve this question






























    3















    I have a headless server that is logged into remotely by multiple users. None of the other users are in the sudoers file, so they cannot obtain root via sudo. However, since the permissions on su are -rwsr-xr-x there's nothing stopping them from attempting to brute force the root password.



    One could argue that if a user knows the root password they can compromise the system anyway, but I don't think this is the case. OpenSSH is configured with PermitRootLogin no and PasswordAuthentication no, and none of the other users have physical access to the server. As far as I can tell, the world execute permission on /usr/bin/su is the only avenue for users attempting to gain root on my server.



    What's further puzzling to me in that it doesn't even seem useful. It allows me to run su directly instead of needing to do sudo su, but this is hardly an inconvenience.



    Am I overlooking something? Is the world execute permission on su just there for historic reasons? Are there any downsides to removing that permission that I haven't encountered yet?










    share|improve this question


























      3












      3








      3








      I have a headless server that is logged into remotely by multiple users. None of the other users are in the sudoers file, so they cannot obtain root via sudo. However, since the permissions on su are -rwsr-xr-x there's nothing stopping them from attempting to brute force the root password.



      One could argue that if a user knows the root password they can compromise the system anyway, but I don't think this is the case. OpenSSH is configured with PermitRootLogin no and PasswordAuthentication no, and none of the other users have physical access to the server. As far as I can tell, the world execute permission on /usr/bin/su is the only avenue for users attempting to gain root on my server.



      What's further puzzling to me in that it doesn't even seem useful. It allows me to run su directly instead of needing to do sudo su, but this is hardly an inconvenience.



      Am I overlooking something? Is the world execute permission on su just there for historic reasons? Are there any downsides to removing that permission that I haven't encountered yet?










      share|improve this question














      I have a headless server that is logged into remotely by multiple users. None of the other users are in the sudoers file, so they cannot obtain root via sudo. However, since the permissions on su are -rwsr-xr-x there's nothing stopping them from attempting to brute force the root password.



      One could argue that if a user knows the root password they can compromise the system anyway, but I don't think this is the case. OpenSSH is configured with PermitRootLogin no and PasswordAuthentication no, and none of the other users have physical access to the server. As far as I can tell, the world execute permission on /usr/bin/su is the only avenue for users attempting to gain root on my server.



      What's further puzzling to me in that it doesn't even seem useful. It allows me to run su directly instead of needing to do sudo su, but this is hardly an inconvenience.



      Am I overlooking something? Is the world execute permission on su just there for historic reasons? Are there any downsides to removing that permission that I haven't encountered yet?







      sudo su headless






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 9 hours ago









      Altay_HAltay_H

      505 bronze badges




      505 bronze badges























          3 Answers
          3






          active

          oldest

          votes


















          5














          One point that is missing from @ilkkachu's answer is that elevating to root is only one specific use for su. The general purpose of su is to open a new shell under another user's login account. That other user could be root (and perhaps most often is), but su can be used to assume any identity the local system can authenticate.



          For example, if I'm logged in as user jim, and I want to investigate a problem that mike has reported, but which I am unable to reproduce, I might try logging in as mike, and running the command that is giving him trouble.



          13:27:20 /home/jim> su -l mike
          Password:(I type mike's password (or have him type it) and press Enter)
          13:27:22 /home/mike> id
          uid=1004(mike) gid=1004(mike) groups=1004(mike)
          13:27:25 /home/mike> exit # this leaves mike's login shell and returns to jim's
          13:27:29 /home/jim> id
          uid=1001(jim) gid=1001(jim) groups=1001(jim),0(wheel),5(operator),14(ftp),920(vboxusers)


          Using the -l option of su causes it to simulate a full login (per the man page).



          The above requires knowledge of mike's password, however. If I have sudo access, I can log in as mike even without his password.



          13:27:37 /home/jim> sudo su -l mike
          Password:(I type my own password, because this is sudo asking)
          13:27:41 /home/mike>


          In summary, the reason the permissions on the su executable are as you show, is because su is a general-purpose tool that is available to all users on the system.






          share|improve this answer



























          • That makes a lot of sense. Since I'm in the habit of using sudo I forgot that su can be used for more than just sudo -s. And without being a sudoer this would be the only way to switch users without altering ssh keys. For my use case this is another reason to remove the permission, but I understand now why the world execute permission is set by default. Thanks!

            – Altay_H
            7 hours ago


















          3















          However, since the permissions on su are -rwsr-xr-x there's nothing stopping them from attempting to brute force the root password.




          Yes. Assuming your usual Linux system, the pam_unix.so module does delay a failed authentication attempt by ~two seconds, but I don't think there's anything to stop simultaneous attempts.



          Failed attempts are logged of course:



          Aug 16 22:52:33 somehost su[17387]: FAILED su for root by ilkkachu


          Brute-forcing a password should show up prominently in the logs, if you have any kind of system for monitoring them. And if you have untrusted local users, maybe you should. Untrusted local users could also attempt to use any local-only privilege escalation exploits, and they're much more common than remote privilege escalation.




          What's further puzzling to me in that it doesn't even seem useful.




          Of course it's useful, it allows you to elevate yourself to root, if you know the password.




          It allows me to run su directly instead of needing to do sudo su, but this is hardly an inconvenience.




          sudo su is somewhat redundant. There's no need to use two programs that are meant to allow you to run programs as another user, one is quite enough. Just use sudo -i or sudo -s (or sudo /bin/bash etc.) if you want to run shell.




          Am I overlooking something? Is the world execute permission on su just there for historic reasons?




          See above. Well, not all systems have sudo as an alternative, I'm not sure if you consider that historic.




          Are there any downsides to removing that permission that I haven't encountered yet?




          Not really, no as far as I know. I think some systems have su set so that only members of a particular group ("wheel") can run it. You can do the same to sudo if you like (chown root.sudousers /usr/bin/sudo && chmod 4710 /usr/bin/sudo).



          Or you could just remove either or both of the programs if you don't need them. Though on Debian, su comes with the login package, so it's probably not a good idea to remove the package as a whole. (And pairing login and su together like that does seem somewhat historic.)






          share|improve this answer

























          • BSD systems require users to be in the wheel group to use su. There are some BSD systems (I can only speak for OpenBSD) that does not ship with sudo at all (it's a 3rd-party package). OpenBSD has doas which is a reimplementation of the basics of sudo, but it's disabled by default upon installing a fresh system.

            – Kusalananda
            8 hours ago











          • @Kusalananda You only have to be in wheel if you want to su to root. Any account can su to any non-root account for which they have the password, regardless of their membership in the wheel group.

            – Jim L.
            7 hours ago












          • I run 'sudo su -' to ensure that the root shell I get is a full root login, without a polluted environment from my user account. The default sudoers on RHEL includes quite a few environment variables that are executable (such as PS1).

            – jsbillings
            5 hours ago


















          1














          You already have some good answers, but there's one part of your post they don't address.




          As far as I can tell, the world execute permission on /usr/bin/su is the only avenue for users attempting to gain root on my server.




          That's a dangerous assumption. If you've set a good password for root, then it in most cases is far more likely that a successful privilege escalation will be due to the exploitation of a bug in the kernel or a setuid binary (you can of course also remove the setuid bit from those, but passwd is setuid, and if you want to high security you should also offer that to your users, and denying them the option of changing their password is not compatible with that).






          share|improve this answer



























            Your Answer








            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "106"
            ;
            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: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            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%2funix.stackexchange.com%2fquestions%2f535936%2fwhy-is-su-world-executable%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            3 Answers
            3






            active

            oldest

            votes








            3 Answers
            3






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            5














            One point that is missing from @ilkkachu's answer is that elevating to root is only one specific use for su. The general purpose of su is to open a new shell under another user's login account. That other user could be root (and perhaps most often is), but su can be used to assume any identity the local system can authenticate.



            For example, if I'm logged in as user jim, and I want to investigate a problem that mike has reported, but which I am unable to reproduce, I might try logging in as mike, and running the command that is giving him trouble.



            13:27:20 /home/jim> su -l mike
            Password:(I type mike's password (or have him type it) and press Enter)
            13:27:22 /home/mike> id
            uid=1004(mike) gid=1004(mike) groups=1004(mike)
            13:27:25 /home/mike> exit # this leaves mike's login shell and returns to jim's
            13:27:29 /home/jim> id
            uid=1001(jim) gid=1001(jim) groups=1001(jim),0(wheel),5(operator),14(ftp),920(vboxusers)


            Using the -l option of su causes it to simulate a full login (per the man page).



            The above requires knowledge of mike's password, however. If I have sudo access, I can log in as mike even without his password.



            13:27:37 /home/jim> sudo su -l mike
            Password:(I type my own password, because this is sudo asking)
            13:27:41 /home/mike>


            In summary, the reason the permissions on the su executable are as you show, is because su is a general-purpose tool that is available to all users on the system.






            share|improve this answer



























            • That makes a lot of sense. Since I'm in the habit of using sudo I forgot that su can be used for more than just sudo -s. And without being a sudoer this would be the only way to switch users without altering ssh keys. For my use case this is another reason to remove the permission, but I understand now why the world execute permission is set by default. Thanks!

              – Altay_H
              7 hours ago















            5














            One point that is missing from @ilkkachu's answer is that elevating to root is only one specific use for su. The general purpose of su is to open a new shell under another user's login account. That other user could be root (and perhaps most often is), but su can be used to assume any identity the local system can authenticate.



            For example, if I'm logged in as user jim, and I want to investigate a problem that mike has reported, but which I am unable to reproduce, I might try logging in as mike, and running the command that is giving him trouble.



            13:27:20 /home/jim> su -l mike
            Password:(I type mike's password (or have him type it) and press Enter)
            13:27:22 /home/mike> id
            uid=1004(mike) gid=1004(mike) groups=1004(mike)
            13:27:25 /home/mike> exit # this leaves mike's login shell and returns to jim's
            13:27:29 /home/jim> id
            uid=1001(jim) gid=1001(jim) groups=1001(jim),0(wheel),5(operator),14(ftp),920(vboxusers)


            Using the -l option of su causes it to simulate a full login (per the man page).



            The above requires knowledge of mike's password, however. If I have sudo access, I can log in as mike even without his password.



            13:27:37 /home/jim> sudo su -l mike
            Password:(I type my own password, because this is sudo asking)
            13:27:41 /home/mike>


            In summary, the reason the permissions on the su executable are as you show, is because su is a general-purpose tool that is available to all users on the system.






            share|improve this answer



























            • That makes a lot of sense. Since I'm in the habit of using sudo I forgot that su can be used for more than just sudo -s. And without being a sudoer this would be the only way to switch users without altering ssh keys. For my use case this is another reason to remove the permission, but I understand now why the world execute permission is set by default. Thanks!

              – Altay_H
              7 hours ago













            5












            5








            5







            One point that is missing from @ilkkachu's answer is that elevating to root is only one specific use for su. The general purpose of su is to open a new shell under another user's login account. That other user could be root (and perhaps most often is), but su can be used to assume any identity the local system can authenticate.



            For example, if I'm logged in as user jim, and I want to investigate a problem that mike has reported, but which I am unable to reproduce, I might try logging in as mike, and running the command that is giving him trouble.



            13:27:20 /home/jim> su -l mike
            Password:(I type mike's password (or have him type it) and press Enter)
            13:27:22 /home/mike> id
            uid=1004(mike) gid=1004(mike) groups=1004(mike)
            13:27:25 /home/mike> exit # this leaves mike's login shell and returns to jim's
            13:27:29 /home/jim> id
            uid=1001(jim) gid=1001(jim) groups=1001(jim),0(wheel),5(operator),14(ftp),920(vboxusers)


            Using the -l option of su causes it to simulate a full login (per the man page).



            The above requires knowledge of mike's password, however. If I have sudo access, I can log in as mike even without his password.



            13:27:37 /home/jim> sudo su -l mike
            Password:(I type my own password, because this is sudo asking)
            13:27:41 /home/mike>


            In summary, the reason the permissions on the su executable are as you show, is because su is a general-purpose tool that is available to all users on the system.






            share|improve this answer















            One point that is missing from @ilkkachu's answer is that elevating to root is only one specific use for su. The general purpose of su is to open a new shell under another user's login account. That other user could be root (and perhaps most often is), but su can be used to assume any identity the local system can authenticate.



            For example, if I'm logged in as user jim, and I want to investigate a problem that mike has reported, but which I am unable to reproduce, I might try logging in as mike, and running the command that is giving him trouble.



            13:27:20 /home/jim> su -l mike
            Password:(I type mike's password (or have him type it) and press Enter)
            13:27:22 /home/mike> id
            uid=1004(mike) gid=1004(mike) groups=1004(mike)
            13:27:25 /home/mike> exit # this leaves mike's login shell and returns to jim's
            13:27:29 /home/jim> id
            uid=1001(jim) gid=1001(jim) groups=1001(jim),0(wheel),5(operator),14(ftp),920(vboxusers)


            Using the -l option of su causes it to simulate a full login (per the man page).



            The above requires knowledge of mike's password, however. If I have sudo access, I can log in as mike even without his password.



            13:27:37 /home/jim> sudo su -l mike
            Password:(I type my own password, because this is sudo asking)
            13:27:41 /home/mike>


            In summary, the reason the permissions on the su executable are as you show, is because su is a general-purpose tool that is available to all users on the system.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited 6 hours ago

























            answered 7 hours ago









            Jim L.Jim L.

            1,6413 silver badges9 bronze badges




            1,6413 silver badges9 bronze badges















            • That makes a lot of sense. Since I'm in the habit of using sudo I forgot that su can be used for more than just sudo -s. And without being a sudoer this would be the only way to switch users without altering ssh keys. For my use case this is another reason to remove the permission, but I understand now why the world execute permission is set by default. Thanks!

              – Altay_H
              7 hours ago

















            • That makes a lot of sense. Since I'm in the habit of using sudo I forgot that su can be used for more than just sudo -s. And without being a sudoer this would be the only way to switch users without altering ssh keys. For my use case this is another reason to remove the permission, but I understand now why the world execute permission is set by default. Thanks!

              – Altay_H
              7 hours ago
















            That makes a lot of sense. Since I'm in the habit of using sudo I forgot that su can be used for more than just sudo -s. And without being a sudoer this would be the only way to switch users without altering ssh keys. For my use case this is another reason to remove the permission, but I understand now why the world execute permission is set by default. Thanks!

            – Altay_H
            7 hours ago





            That makes a lot of sense. Since I'm in the habit of using sudo I forgot that su can be used for more than just sudo -s. And without being a sudoer this would be the only way to switch users without altering ssh keys. For my use case this is another reason to remove the permission, but I understand now why the world execute permission is set by default. Thanks!

            – Altay_H
            7 hours ago













            3















            However, since the permissions on su are -rwsr-xr-x there's nothing stopping them from attempting to brute force the root password.




            Yes. Assuming your usual Linux system, the pam_unix.so module does delay a failed authentication attempt by ~two seconds, but I don't think there's anything to stop simultaneous attempts.



            Failed attempts are logged of course:



            Aug 16 22:52:33 somehost su[17387]: FAILED su for root by ilkkachu


            Brute-forcing a password should show up prominently in the logs, if you have any kind of system for monitoring them. And if you have untrusted local users, maybe you should. Untrusted local users could also attempt to use any local-only privilege escalation exploits, and they're much more common than remote privilege escalation.




            What's further puzzling to me in that it doesn't even seem useful.




            Of course it's useful, it allows you to elevate yourself to root, if you know the password.




            It allows me to run su directly instead of needing to do sudo su, but this is hardly an inconvenience.




            sudo su is somewhat redundant. There's no need to use two programs that are meant to allow you to run programs as another user, one is quite enough. Just use sudo -i or sudo -s (or sudo /bin/bash etc.) if you want to run shell.




            Am I overlooking something? Is the world execute permission on su just there for historic reasons?




            See above. Well, not all systems have sudo as an alternative, I'm not sure if you consider that historic.




            Are there any downsides to removing that permission that I haven't encountered yet?




            Not really, no as far as I know. I think some systems have su set so that only members of a particular group ("wheel") can run it. You can do the same to sudo if you like (chown root.sudousers /usr/bin/sudo && chmod 4710 /usr/bin/sudo).



            Or you could just remove either or both of the programs if you don't need them. Though on Debian, su comes with the login package, so it's probably not a good idea to remove the package as a whole. (And pairing login and su together like that does seem somewhat historic.)






            share|improve this answer

























            • BSD systems require users to be in the wheel group to use su. There are some BSD systems (I can only speak for OpenBSD) that does not ship with sudo at all (it's a 3rd-party package). OpenBSD has doas which is a reimplementation of the basics of sudo, but it's disabled by default upon installing a fresh system.

              – Kusalananda
              8 hours ago











            • @Kusalananda You only have to be in wheel if you want to su to root. Any account can su to any non-root account for which they have the password, regardless of their membership in the wheel group.

              – Jim L.
              7 hours ago












            • I run 'sudo su -' to ensure that the root shell I get is a full root login, without a polluted environment from my user account. The default sudoers on RHEL includes quite a few environment variables that are executable (such as PS1).

              – jsbillings
              5 hours ago















            3















            However, since the permissions on su are -rwsr-xr-x there's nothing stopping them from attempting to brute force the root password.




            Yes. Assuming your usual Linux system, the pam_unix.so module does delay a failed authentication attempt by ~two seconds, but I don't think there's anything to stop simultaneous attempts.



            Failed attempts are logged of course:



            Aug 16 22:52:33 somehost su[17387]: FAILED su for root by ilkkachu


            Brute-forcing a password should show up prominently in the logs, if you have any kind of system for monitoring them. And if you have untrusted local users, maybe you should. Untrusted local users could also attempt to use any local-only privilege escalation exploits, and they're much more common than remote privilege escalation.




            What's further puzzling to me in that it doesn't even seem useful.




            Of course it's useful, it allows you to elevate yourself to root, if you know the password.




            It allows me to run su directly instead of needing to do sudo su, but this is hardly an inconvenience.




            sudo su is somewhat redundant. There's no need to use two programs that are meant to allow you to run programs as another user, one is quite enough. Just use sudo -i or sudo -s (or sudo /bin/bash etc.) if you want to run shell.




            Am I overlooking something? Is the world execute permission on su just there for historic reasons?




            See above. Well, not all systems have sudo as an alternative, I'm not sure if you consider that historic.




            Are there any downsides to removing that permission that I haven't encountered yet?




            Not really, no as far as I know. I think some systems have su set so that only members of a particular group ("wheel") can run it. You can do the same to sudo if you like (chown root.sudousers /usr/bin/sudo && chmod 4710 /usr/bin/sudo).



            Or you could just remove either or both of the programs if you don't need them. Though on Debian, su comes with the login package, so it's probably not a good idea to remove the package as a whole. (And pairing login and su together like that does seem somewhat historic.)






            share|improve this answer

























            • BSD systems require users to be in the wheel group to use su. There are some BSD systems (I can only speak for OpenBSD) that does not ship with sudo at all (it's a 3rd-party package). OpenBSD has doas which is a reimplementation of the basics of sudo, but it's disabled by default upon installing a fresh system.

              – Kusalananda
              8 hours ago











            • @Kusalananda You only have to be in wheel if you want to su to root. Any account can su to any non-root account for which they have the password, regardless of their membership in the wheel group.

              – Jim L.
              7 hours ago












            • I run 'sudo su -' to ensure that the root shell I get is a full root login, without a polluted environment from my user account. The default sudoers on RHEL includes quite a few environment variables that are executable (such as PS1).

              – jsbillings
              5 hours ago













            3












            3








            3








            However, since the permissions on su are -rwsr-xr-x there's nothing stopping them from attempting to brute force the root password.




            Yes. Assuming your usual Linux system, the pam_unix.so module does delay a failed authentication attempt by ~two seconds, but I don't think there's anything to stop simultaneous attempts.



            Failed attempts are logged of course:



            Aug 16 22:52:33 somehost su[17387]: FAILED su for root by ilkkachu


            Brute-forcing a password should show up prominently in the logs, if you have any kind of system for monitoring them. And if you have untrusted local users, maybe you should. Untrusted local users could also attempt to use any local-only privilege escalation exploits, and they're much more common than remote privilege escalation.




            What's further puzzling to me in that it doesn't even seem useful.




            Of course it's useful, it allows you to elevate yourself to root, if you know the password.




            It allows me to run su directly instead of needing to do sudo su, but this is hardly an inconvenience.




            sudo su is somewhat redundant. There's no need to use two programs that are meant to allow you to run programs as another user, one is quite enough. Just use sudo -i or sudo -s (or sudo /bin/bash etc.) if you want to run shell.




            Am I overlooking something? Is the world execute permission on su just there for historic reasons?




            See above. Well, not all systems have sudo as an alternative, I'm not sure if you consider that historic.




            Are there any downsides to removing that permission that I haven't encountered yet?




            Not really, no as far as I know. I think some systems have su set so that only members of a particular group ("wheel") can run it. You can do the same to sudo if you like (chown root.sudousers /usr/bin/sudo && chmod 4710 /usr/bin/sudo).



            Or you could just remove either or both of the programs if you don't need them. Though on Debian, su comes with the login package, so it's probably not a good idea to remove the package as a whole. (And pairing login and su together like that does seem somewhat historic.)






            share|improve this answer














            However, since the permissions on su are -rwsr-xr-x there's nothing stopping them from attempting to brute force the root password.




            Yes. Assuming your usual Linux system, the pam_unix.so module does delay a failed authentication attempt by ~two seconds, but I don't think there's anything to stop simultaneous attempts.



            Failed attempts are logged of course:



            Aug 16 22:52:33 somehost su[17387]: FAILED su for root by ilkkachu


            Brute-forcing a password should show up prominently in the logs, if you have any kind of system for monitoring them. And if you have untrusted local users, maybe you should. Untrusted local users could also attempt to use any local-only privilege escalation exploits, and they're much more common than remote privilege escalation.




            What's further puzzling to me in that it doesn't even seem useful.




            Of course it's useful, it allows you to elevate yourself to root, if you know the password.




            It allows me to run su directly instead of needing to do sudo su, but this is hardly an inconvenience.




            sudo su is somewhat redundant. There's no need to use two programs that are meant to allow you to run programs as another user, one is quite enough. Just use sudo -i or sudo -s (or sudo /bin/bash etc.) if you want to run shell.




            Am I overlooking something? Is the world execute permission on su just there for historic reasons?




            See above. Well, not all systems have sudo as an alternative, I'm not sure if you consider that historic.




            Are there any downsides to removing that permission that I haven't encountered yet?




            Not really, no as far as I know. I think some systems have su set so that only members of a particular group ("wheel") can run it. You can do the same to sudo if you like (chown root.sudousers /usr/bin/sudo && chmod 4710 /usr/bin/sudo).



            Or you could just remove either or both of the programs if you don't need them. Though on Debian, su comes with the login package, so it's probably not a good idea to remove the package as a whole. (And pairing login and su together like that does seem somewhat historic.)







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered 8 hours ago









            ilkkachuilkkachu

            67k10 gold badges111 silver badges193 bronze badges




            67k10 gold badges111 silver badges193 bronze badges















            • BSD systems require users to be in the wheel group to use su. There are some BSD systems (I can only speak for OpenBSD) that does not ship with sudo at all (it's a 3rd-party package). OpenBSD has doas which is a reimplementation of the basics of sudo, but it's disabled by default upon installing a fresh system.

              – Kusalananda
              8 hours ago











            • @Kusalananda You only have to be in wheel if you want to su to root. Any account can su to any non-root account for which they have the password, regardless of their membership in the wheel group.

              – Jim L.
              7 hours ago












            • I run 'sudo su -' to ensure that the root shell I get is a full root login, without a polluted environment from my user account. The default sudoers on RHEL includes quite a few environment variables that are executable (such as PS1).

              – jsbillings
              5 hours ago

















            • BSD systems require users to be in the wheel group to use su. There are some BSD systems (I can only speak for OpenBSD) that does not ship with sudo at all (it's a 3rd-party package). OpenBSD has doas which is a reimplementation of the basics of sudo, but it's disabled by default upon installing a fresh system.

              – Kusalananda
              8 hours ago











            • @Kusalananda You only have to be in wheel if you want to su to root. Any account can su to any non-root account for which they have the password, regardless of their membership in the wheel group.

              – Jim L.
              7 hours ago












            • I run 'sudo su -' to ensure that the root shell I get is a full root login, without a polluted environment from my user account. The default sudoers on RHEL includes quite a few environment variables that are executable (such as PS1).

              – jsbillings
              5 hours ago
















            BSD systems require users to be in the wheel group to use su. There are some BSD systems (I can only speak for OpenBSD) that does not ship with sudo at all (it's a 3rd-party package). OpenBSD has doas which is a reimplementation of the basics of sudo, but it's disabled by default upon installing a fresh system.

            – Kusalananda
            8 hours ago





            BSD systems require users to be in the wheel group to use su. There are some BSD systems (I can only speak for OpenBSD) that does not ship with sudo at all (it's a 3rd-party package). OpenBSD has doas which is a reimplementation of the basics of sudo, but it's disabled by default upon installing a fresh system.

            – Kusalananda
            8 hours ago













            @Kusalananda You only have to be in wheel if you want to su to root. Any account can su to any non-root account for which they have the password, regardless of their membership in the wheel group.

            – Jim L.
            7 hours ago






            @Kusalananda You only have to be in wheel if you want to su to root. Any account can su to any non-root account for which they have the password, regardless of their membership in the wheel group.

            – Jim L.
            7 hours ago














            I run 'sudo su -' to ensure that the root shell I get is a full root login, without a polluted environment from my user account. The default sudoers on RHEL includes quite a few environment variables that are executable (such as PS1).

            – jsbillings
            5 hours ago





            I run 'sudo su -' to ensure that the root shell I get is a full root login, without a polluted environment from my user account. The default sudoers on RHEL includes quite a few environment variables that are executable (such as PS1).

            – jsbillings
            5 hours ago











            1














            You already have some good answers, but there's one part of your post they don't address.




            As far as I can tell, the world execute permission on /usr/bin/su is the only avenue for users attempting to gain root on my server.




            That's a dangerous assumption. If you've set a good password for root, then it in most cases is far more likely that a successful privilege escalation will be due to the exploitation of a bug in the kernel or a setuid binary (you can of course also remove the setuid bit from those, but passwd is setuid, and if you want to high security you should also offer that to your users, and denying them the option of changing their password is not compatible with that).






            share|improve this answer





























              1














              You already have some good answers, but there's one part of your post they don't address.




              As far as I can tell, the world execute permission on /usr/bin/su is the only avenue for users attempting to gain root on my server.




              That's a dangerous assumption. If you've set a good password for root, then it in most cases is far more likely that a successful privilege escalation will be due to the exploitation of a bug in the kernel or a setuid binary (you can of course also remove the setuid bit from those, but passwd is setuid, and if you want to high security you should also offer that to your users, and denying them the option of changing their password is not compatible with that).






              share|improve this answer



























                1












                1








                1







                You already have some good answers, but there's one part of your post they don't address.




                As far as I can tell, the world execute permission on /usr/bin/su is the only avenue for users attempting to gain root on my server.




                That's a dangerous assumption. If you've set a good password for root, then it in most cases is far more likely that a successful privilege escalation will be due to the exploitation of a bug in the kernel or a setuid binary (you can of course also remove the setuid bit from those, but passwd is setuid, and if you want to high security you should also offer that to your users, and denying them the option of changing their password is not compatible with that).






                share|improve this answer













                You already have some good answers, but there's one part of your post they don't address.




                As far as I can tell, the world execute permission on /usr/bin/su is the only avenue for users attempting to gain root on my server.




                That's a dangerous assumption. If you've set a good password for root, then it in most cases is far more likely that a successful privilege escalation will be due to the exploitation of a bug in the kernel or a setuid binary (you can of course also remove the setuid bit from those, but passwd is setuid, and if you want to high security you should also offer that to your users, and denying them the option of changing their password is not compatible with that).







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered 5 hours ago









                HenrikHenrik

                3,7491 gold badge5 silver badges22 bronze badges




                3,7491 gold badge5 silver badges22 bronze badges






























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Unix & Linux Stack Exchange!


                    • 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%2funix.stackexchange.com%2fquestions%2f535936%2fwhy-is-su-world-executable%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

                    Invision Community Contents History See also References External links Navigation menuProprietaryinvisioncommunity.comIPS Community ForumsIPS Community Forumsthis blog entry"License Changes, IP.Board 3.4, and the Future""Interview -- Matt Mecham of Ibforums""CEO Invision Power Board, Matt Mecham Is a Liar, Thief!"IPB License Explanation 1.3, 1.3.1, 2.0, and 2.1ArchivedSecurity Fixes, Updates And Enhancements For IPB 1.3.1Archived"New Demo Accounts - Invision Power Services"the original"New Default Skin"the original"Invision Power Board 3.0.0 and Applications Released"the original"Archived copy"the original"Perpetual licenses being done away with""Release Notes - Invision Power Services""Introducing: IPS Community Suite 4!"Invision Community Release Notes

                    Canceling a color specificationRandomly assigning color to Graphics3D objects?Default color for Filling in Mathematica 9Coloring specific elements of sets with a prime modified order in an array plotHow to pick a color differing significantly from the colors already in a given color list?Detection of the text colorColor numbers based on their valueCan color schemes for use with ColorData include opacity specification?My dynamic color schemes

                    Tom Holland Mục lục Đầu đời và giáo dục | Sự nghiệp | Cuộc sống cá nhân | Phim tham gia | Giải thưởng và đề cử | Chú thích | Liên kết ngoài | Trình đơn chuyển hướngProfile“Person Details for Thomas Stanley Holland, "England and Wales Birth Registration Index, 1837-2008" — FamilySearch.org”"Meet Tom Holland... the 16-year-old star of The Impossible""Schoolboy actor Tom Holland finds himself in Oscar contention for role in tsunami drama"“Naomi Watts on the Prince William and Harry's reaction to her film about the late Princess Diana”lưu trữ"Holland and Pflueger Are West End's Two New 'Billy Elliots'""I'm so envious of my son, the movie star! British writer Dominic Holland's spent 20 years trying to crack Hollywood - but he's been beaten to it by a very unlikely rival"“Richard and Margaret Povey of Jersey, Channel Islands, UK: Information about Thomas Stanley Holland”"Tom Holland to play Billy Elliot""New Billy Elliot leaving the garage"Billy Elliot the Musical - Tom Holland - Billy"A Tale of four Billys: Tom Holland""The Feel Good Factor""Thames Christian College schoolboys join Myleene Klass for The Feelgood Factor""Government launches £600,000 arts bursaries pilot""BILLY's Chapman, Holland, Gardner & Jackson-Keen Visit Prime Minister""Elton John 'blown away' by Billy Elliot fifth birthday" (video with John's interview and fragments of Holland's performance)"First News interviews Arrietty's Tom Holland"“33rd Critics' Circle Film Awards winners”“National Board of Review Current Awards”Bản gốc"Ron Howard Whaling Tale 'In The Heart Of The Sea' Casts Tom Holland"“'Spider-Man' Finds Tom Holland to Star as New Web-Slinger”lưu trữ“Captain America: Civil War (2016)”“Film Review: ‘Captain America: Civil War’”lưu trữ“‘Captain America: Civil War’ review: Choose your own avenger”lưu trữ“The Lost City of Z reviews”“Sony Pictures and Marvel Studios Find Their 'Spider-Man' Star and Director”“‘Mary Magdalene’, ‘Current War’ & ‘Wind River’ Get 2017 Release Dates From Weinstein”“Lionsgate Unleashing Daisy Ridley & Tom Holland Starrer ‘Chaos Walking’ In Cannes”“PTA's 'Master' Leads Chicago Film Critics Nominations, UPDATED: Houston and Indiana Critics Nominations”“Nominaciones Goya 2013 Telecinco Cinema – ENG”“Jameson Empire Film Awards: Martin Freeman wins best actor for performance in The Hobbit”“34th Annual Young Artist Awards”Bản gốc“Teen Choice Awards 2016—Captain America: Civil War Leads Second Wave of Nominations”“BAFTA Film Award Nominations: ‘La La Land’ Leads Race”“Saturn Awards Nominations 2017: 'Rogue One,' 'Walking Dead' Lead”Tom HollandTom HollandTom HollandTom Hollandmedia.gettyimages.comWorldCat Identities300279794no20130442900000 0004 0355 42791085670554170004732cb16706349t(data)XX5557367