Take the 2-minute tour ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

I seen a lot of apps in the market that give superuser functionality to applications. However there is a pre-requisite of rooting your phone. I am curious how a rooted phone has those permissions already?

I've downloaded the source code and have managed to locate the su.c file that might invoke an application to change. But im still not sure. Can anyone give an insight on this?

Which actual files delegate permissions? Are all system apps given root permissions at startup?

share|improve this question
add comment

4 Answers

A developer has to call su within the application. once it calls that, and the user has granted permission to use su, then they run commands in the shell that has root permissions.

In a way, system apps have "special" permissions but not root like an app would get by calling su. They have the permissions that android grants system applications.

share|improve this answer
add comment

Once upon a time, there is a walled city with a large, closed gate bound by magical lock that can only be opened with a magical sword. According to the cityfolk's traditions, anyone who brings the magic sword and unlocked the magical gate is destined to be the lord of the city.

One day, a young hero comes to the city, bringing with him the magical sword he took from the root of the Yggdrasil tree. He tapped the sword lightly on the door, and immediately the magical gate unlocked itself and peered open. The cityfolks cheered, and as per their tradition, they anointed the young hero as the city's lord.

As a city lord, there are many tasks he had to do, one of which is to ensure the security of his people, especially now that the gate is open and bandits and thieves may attempt to enter the city and rob the cityfolks' of their belongings.

To ensure the peaceful days of the cityfolks, the wise lord hired a trusted SU manager to guard the gate; dutifully, the SU manager enters the city, and he closed the gate behind him, and he put a lock that only he can open, then he creates a big door knob for strangers to knock the gate, a small hole on the door where he can peek outside and look at the strangers, then asks the city's lord whether or not to allow strangers in.

In eternity, the wise lord ruled the city for a long time and the cityfolks lives happily ever after.

share|improve this answer
5  
This is great (no downvote), but a little too obtuse (no upvote). –  Matthew Read Mar 14 '11 at 15:41
2  
I lol'ed at this –  Bryan Denny Mar 14 '11 at 15:44
1  
a good story with a happy ending. –  Jayrox Mar 14 '11 at 17:15
    
@MatthewRead I'm pretty sure that is literally how it works; Android is actually made of little people. ;) –  CatShoes Nov 19 '12 at 20:46
add comment

Which actual files delegate permissions?

There is typically a "superuser" application that is included in rooting processes. This application is the gatekeeper/controller of which applications get root access. Any time an application asks for root access, this application will pop up and ask you to either approve or deny the request.

Are all system apps given root permissions at startup?

As far as I know, everything must go through the "superuser" app.

share|improve this answer
    
Unless they exploit some other exploit to get root. This, hopefully, is not a large threat to most users. –  CatShoes Nov 19 '12 at 20:47
add comment

I've been hunting for an answer for this myself, and information has been really elusive. But between other answers and questions here, and reading the Superuser blog, I think I've been able to piece together how it works.

In a standard *Nix system, su checks if the user is authorized to become root (on some systems, everyone is; on others, they have to be a member of group wheel or something), prompts for the root password, and then grants root access.

On a rooted Android, what seems to be happening is that Superuser comes with a custom version of su that figures out what app invoked it, then checks the Superuser access database for whether or not that app is permitted to become root. If it is, then it makes the jump to root. If not, it spawns the authorization UI.

share|improve this answer
add comment

Your Answer

 
discard

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