What is Superuser?
Superuser is the app on rooted android phones that manages what other apps have access to the root user (see below). It also allows you, the user, to see what apps have used the root user and when.
What is the root user?
On a linux system (which android runs on top of) all users are assigned a user id (UID). The UID is what the kernel uses to keep track of, on the most basic level, what files the user has access to. There is a user called root, UID 0, that has read write access to every file and therefore can do anything.
So what does the root user have to to with Android?
On Android every app runs as a particular user. When an app is installed it is assigned a UID that above 10000. The UID that each app is assigned only has access to the files that are located in it’s own data directory located in /data/data. To access any other file, the app must temporarily take on a different UID, usually 0 (or root). That’s what Superuser is for, to allow those apps to temporarily run as root and give them access to parts of the system that they usually would not have access to.
What can root do?
Anything, which is why you must be careful with what you allow to have root access. Everything from removing preinstalled carrier bloat, to tricking the Android market into thinking that you’re in a different country, or backing up all of your game high scores so you can take them with you to a new phone. It can also do harmful things, like read your personal data from any app, delete important files, or even brick your phone. I’m not telling you this to scare you off of rooting, just making sure you know what’s posible.
Why do I see two different version numbers at the bottom of my Preferences screen (Superuser v3.0.6, Su binary v3.0.1)?
There’s two parts Superuser, Superuser.apk, which lives either on the system partition, or in the data partition depending on how it was installed, and the su binary which lives in the executable path. When an app wants root access, it calls the su binary and asks. The su binary will then call Superuser.apk if it can’t find the app in it’s list of allowed apps. Because the su binary is more difficult to update, and because there are risks involved in updating it, the bonary is only updated when it’s absolutely necessary. The apk however is really easy to update, so when I find bugs that can be fixed in the apk, or want to add a new feature, I can easily update it. This causes there to be a difference in version numbers.
What are the most current versions?
At the time of writing this (2011-20-22), the most current version of Superuser is 3.0.6, and the most current version of the su binary is 3.0.1. You can always find the latest version of Superuser here.
I didn’t install Superuser and now I can’t install it!
Not a question, I know, and it’s also (in most cases) not true. If Superuser is installed on your device, it’s either because you installed it, you rooted your phone (which installed Superuser), or your phone was pre rooted when you got it. In most cases typical uninstall procedures will not work because Superuser is installed to the system partition when you root your device, and the system partition is read only at runtime. It is possible to uninstall it, but your phone will not be rooted anymore. You’ll have to use either a terminal emulator or ADB. Here are the commands to uninstall it:
mount -o remount,rw /system
I tried to update the binary, something went wrong, and now I can’t get root access.
Due to the wide variety of devices and ROMs out there, it’s impossible for me to get it exactly right every time. There are a couple ways to fix it. The easiest way to fix it is to download the flashable zip from here, place it on your sd card, reboot into recovery mode and flash it. The next option is to extract the su binary from the zip you downloaded above, and manually put it into /system/bin or /system/xbin, be sure to use chmod to set the file mode to 06755. Finally, you can re-root your phone by whatever method you used before.
Why can’t I update my su binary if it’s in /sbin?
The directory /sbin is a part of what’s called the boot.img. When your phone boots up, the first thing it does is unpack the boot.img, so anything that’s done to at runtime will be overwritten when you reboot your phone. Therefore I don’t even try to update the binary if I find that it’s located in /sbin. What you can do is contact your ROM or kernel developer and tell them to stop putting su in /sbin, or at a minimum, keep it up to date.
Why does the updater fail when it tries to remount /system?
Many devices have some form of write protection on /system that prevents it from being mounted as read/write at runtime. There’s nothing I can do about that. What you can do is try using ROM Manager, or just download the proper zip for your device and flash it in recovery mode.