why does sudo work on Linux but not Android?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
20
down vote

favorite
2












I have not had the chance to read enough about Android, Linux, or UNIX to answer this myself. sudo works on a Linux machine but doesn't work on Android unless you root the mobile device (e.g. Samsung GT-N8013). Why does the mobile device require to be rooted, but not the typical Linux install?




The context of my question is related to
https://stackoverflow.com/questions/14019698/adb-shell-sudo-on-windows-7/14019726#14019726



(Also, is there any way for a program to ask to run as root on Android, the same way you have escalation of privileges to "run as administrator" on Windows? If you think this question should be on its own thread, I can create one)










share|improve this question























  • It should be in sudoers list to get sudo. Its not in Android an Ubuntu
    – user3539
    Dec 26 '12 at 6:14














up vote
20
down vote

favorite
2












I have not had the chance to read enough about Android, Linux, or UNIX to answer this myself. sudo works on a Linux machine but doesn't work on Android unless you root the mobile device (e.g. Samsung GT-N8013). Why does the mobile device require to be rooted, but not the typical Linux install?




The context of my question is related to
https://stackoverflow.com/questions/14019698/adb-shell-sudo-on-windows-7/14019726#14019726



(Also, is there any way for a program to ask to run as root on Android, the same way you have escalation of privileges to "run as administrator" on Windows? If you think this question should be on its own thread, I can create one)










share|improve this question























  • It should be in sudoers list to get sudo. Its not in Android an Ubuntu
    – user3539
    Dec 26 '12 at 6:14












up vote
20
down vote

favorite
2









up vote
20
down vote

favorite
2






2





I have not had the chance to read enough about Android, Linux, or UNIX to answer this myself. sudo works on a Linux machine but doesn't work on Android unless you root the mobile device (e.g. Samsung GT-N8013). Why does the mobile device require to be rooted, but not the typical Linux install?




The context of my question is related to
https://stackoverflow.com/questions/14019698/adb-shell-sudo-on-windows-7/14019726#14019726



(Also, is there any way for a program to ask to run as root on Android, the same way you have escalation of privileges to "run as administrator" on Windows? If you think this question should be on its own thread, I can create one)










share|improve this question















I have not had the chance to read enough about Android, Linux, or UNIX to answer this myself. sudo works on a Linux machine but doesn't work on Android unless you root the mobile device (e.g. Samsung GT-N8013). Why does the mobile device require to be rooted, but not the typical Linux install?




The context of my question is related to
https://stackoverflow.com/questions/14019698/adb-shell-sudo-on-windows-7/14019726#14019726



(Also, is there any way for a program to ask to run as root on Android, the same way you have escalation of privileges to "run as administrator" on Windows? If you think this question should be on its own thread, I can create one)







sudo root android privileges






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited May 23 '17 at 12:40









Community♦

1




1










asked Dec 26 '12 at 0:18









T. Webster

3893517




3893517











  • It should be in sudoers list to get sudo. Its not in Android an Ubuntu
    – user3539
    Dec 26 '12 at 6:14
















  • It should be in sudoers list to get sudo. Its not in Android an Ubuntu
    – user3539
    Dec 26 '12 at 6:14















It should be in sudoers list to get sudo. Its not in Android an Ubuntu
– user3539
Dec 26 '12 at 6:14




It should be in sudoers list to get sudo. Its not in Android an Ubuntu
– user3539
Dec 26 '12 at 6:14










4 Answers
4






active

oldest

votes

















up vote
19
down vote



accepted










sudo is a a normal application with the suid bit. This means in order to use sudo it has to be installed on the system. Not all Linux systems have sudo installed per default like for example Debian.



Most Android systems are targeted for end users who don't need to know the internals of Android (i.e. each Android applications runs under it's own user), so there is no need to provide an interactive way for an enduser to run a command as system administrator.



In general you can use su instead of sudo to run a command as a different user but you have to know the credentials for the target user for su (for sudo you have to know the credentials of the user running the command)






share|improve this answer



























    up vote
    9
    down vote













    sudo is not universal. Just because it exists on the particular Linux distro you use, doesn't mean it's available on all OSes that also use the Linux kernel.






    share|improve this answer





























      up vote
      8
      down vote













      The phone has to be rooted to have the root user install sudo (or any other app). Otherwise it would be installed as the "standard" user and not have root access.



      As for the second question, once sudo is installed on the rooted phone, in my experience, the apps that need it simply request it and you get a popup prompt.






      share|improve this answer



























        up vote
        4
        down vote













        You touch on a critical point in your question: a typical Linux install IS rooting: you boot from a Live CD and overwrite the bootsector of the harddrive to load your own code.



        It's just that rooting a PC is less arduous than on a semi embedded device like a phone so that people tend to forget that installing a second OS with dual-boot is essentially rooting (the only thing that will fight you on this is the BIOS with secure boot but that can be easily reset).



        And the OS on the Android device just doesn't come with the sudo command (or similar) installed.






        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',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          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%2f59434%2fwhy-does-sudo-work-on-linux-but-not-android%23new-answer', 'question_page');

          );

          Post as a guest






























          4 Answers
          4






          active

          oldest

          votes








          4 Answers
          4






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          19
          down vote



          accepted










          sudo is a a normal application with the suid bit. This means in order to use sudo it has to be installed on the system. Not all Linux systems have sudo installed per default like for example Debian.



          Most Android systems are targeted for end users who don't need to know the internals of Android (i.e. each Android applications runs under it's own user), so there is no need to provide an interactive way for an enduser to run a command as system administrator.



          In general you can use su instead of sudo to run a command as a different user but you have to know the credentials for the target user for su (for sudo you have to know the credentials of the user running the command)






          share|improve this answer
























            up vote
            19
            down vote



            accepted










            sudo is a a normal application with the suid bit. This means in order to use sudo it has to be installed on the system. Not all Linux systems have sudo installed per default like for example Debian.



            Most Android systems are targeted for end users who don't need to know the internals of Android (i.e. each Android applications runs under it's own user), so there is no need to provide an interactive way for an enduser to run a command as system administrator.



            In general you can use su instead of sudo to run a command as a different user but you have to know the credentials for the target user for su (for sudo you have to know the credentials of the user running the command)






            share|improve this answer






















              up vote
              19
              down vote



              accepted







              up vote
              19
              down vote



              accepted






              sudo is a a normal application with the suid bit. This means in order to use sudo it has to be installed on the system. Not all Linux systems have sudo installed per default like for example Debian.



              Most Android systems are targeted for end users who don't need to know the internals of Android (i.e. each Android applications runs under it's own user), so there is no need to provide an interactive way for an enduser to run a command as system administrator.



              In general you can use su instead of sudo to run a command as a different user but you have to know the credentials for the target user for su (for sudo you have to know the credentials of the user running the command)






              share|improve this answer












              sudo is a a normal application with the suid bit. This means in order to use sudo it has to be installed on the system. Not all Linux systems have sudo installed per default like for example Debian.



              Most Android systems are targeted for end users who don't need to know the internals of Android (i.e. each Android applications runs under it's own user), so there is no need to provide an interactive way for an enduser to run a command as system administrator.



              In general you can use su instead of sudo to run a command as a different user but you have to know the credentials for the target user for su (for sudo you have to know the credentials of the user running the command)







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Dec 26 '12 at 1:22









              Ulrich Dangel

              20k25671




              20k25671






















                  up vote
                  9
                  down vote













                  sudo is not universal. Just because it exists on the particular Linux distro you use, doesn't mean it's available on all OSes that also use the Linux kernel.






                  share|improve this answer


























                    up vote
                    9
                    down vote













                    sudo is not universal. Just because it exists on the particular Linux distro you use, doesn't mean it's available on all OSes that also use the Linux kernel.






                    share|improve this answer
























                      up vote
                      9
                      down vote










                      up vote
                      9
                      down vote









                      sudo is not universal. Just because it exists on the particular Linux distro you use, doesn't mean it's available on all OSes that also use the Linux kernel.






                      share|improve this answer














                      sudo is not universal. Just because it exists on the particular Linux distro you use, doesn't mean it's available on all OSes that also use the Linux kernel.







                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited Apr 13 '17 at 12:36









                      Community♦

                      1




                      1










                      answered Dec 26 '12 at 1:15









                      Warren Young

                      53.3k8140144




                      53.3k8140144




















                          up vote
                          8
                          down vote













                          The phone has to be rooted to have the root user install sudo (or any other app). Otherwise it would be installed as the "standard" user and not have root access.



                          As for the second question, once sudo is installed on the rooted phone, in my experience, the apps that need it simply request it and you get a popup prompt.






                          share|improve this answer
























                            up vote
                            8
                            down vote













                            The phone has to be rooted to have the root user install sudo (or any other app). Otherwise it would be installed as the "standard" user and not have root access.



                            As for the second question, once sudo is installed on the rooted phone, in my experience, the apps that need it simply request it and you get a popup prompt.






                            share|improve this answer






















                              up vote
                              8
                              down vote










                              up vote
                              8
                              down vote









                              The phone has to be rooted to have the root user install sudo (or any other app). Otherwise it would be installed as the "standard" user and not have root access.



                              As for the second question, once sudo is installed on the rooted phone, in my experience, the apps that need it simply request it and you get a popup prompt.






                              share|improve this answer












                              The phone has to be rooted to have the root user install sudo (or any other app). Otherwise it would be installed as the "standard" user and not have root access.



                              As for the second question, once sudo is installed on the rooted phone, in my experience, the apps that need it simply request it and you get a popup prompt.







                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered Dec 26 '12 at 0:54









                              Aaron D. Marasco

                              3,4681321




                              3,4681321




















                                  up vote
                                  4
                                  down vote













                                  You touch on a critical point in your question: a typical Linux install IS rooting: you boot from a Live CD and overwrite the bootsector of the harddrive to load your own code.



                                  It's just that rooting a PC is less arduous than on a semi embedded device like a phone so that people tend to forget that installing a second OS with dual-boot is essentially rooting (the only thing that will fight you on this is the BIOS with secure boot but that can be easily reset).



                                  And the OS on the Android device just doesn't come with the sudo command (or similar) installed.






                                  share|improve this answer


























                                    up vote
                                    4
                                    down vote













                                    You touch on a critical point in your question: a typical Linux install IS rooting: you boot from a Live CD and overwrite the bootsector of the harddrive to load your own code.



                                    It's just that rooting a PC is less arduous than on a semi embedded device like a phone so that people tend to forget that installing a second OS with dual-boot is essentially rooting (the only thing that will fight you on this is the BIOS with secure boot but that can be easily reset).



                                    And the OS on the Android device just doesn't come with the sudo command (or similar) installed.






                                    share|improve this answer
























                                      up vote
                                      4
                                      down vote










                                      up vote
                                      4
                                      down vote









                                      You touch on a critical point in your question: a typical Linux install IS rooting: you boot from a Live CD and overwrite the bootsector of the harddrive to load your own code.



                                      It's just that rooting a PC is less arduous than on a semi embedded device like a phone so that people tend to forget that installing a second OS with dual-boot is essentially rooting (the only thing that will fight you on this is the BIOS with secure boot but that can be easily reset).



                                      And the OS on the Android device just doesn't come with the sudo command (or similar) installed.






                                      share|improve this answer














                                      You touch on a critical point in your question: a typical Linux install IS rooting: you boot from a Live CD and overwrite the bootsector of the harddrive to load your own code.



                                      It's just that rooting a PC is less arduous than on a semi embedded device like a phone so that people tend to forget that installing a second OS with dual-boot is essentially rooting (the only thing that will fight you on this is the BIOS with secure boot but that can be easily reset).



                                      And the OS on the Android device just doesn't come with the sudo command (or similar) installed.







                                      share|improve this answer














                                      share|improve this answer



                                      share|improve this answer








                                      edited Aug 23 at 8:58

























                                      answered Dec 26 '12 at 5:17









                                      ratchet freak

                                      1412




                                      1412



























                                           

                                          draft saved


                                          draft discarded















































                                           


                                          draft saved


                                          draft discarded














                                          StackExchange.ready(
                                          function ()
                                          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f59434%2fwhy-does-sudo-work-on-linux-but-not-android%23new-answer', 'question_page');

                                          );

                                          Post as a guest













































































                                          Popular posts from this blog

                                          Peggy Mitchell

                                          Palaiologos

                                          The Forum (Inglewood, California)