Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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 http://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
add comment

4 Answers 4

up vote 9 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
add comment

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
add comment

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
add comment

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 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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.