why does sudo work on Linux but not Android?
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)
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.
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.