Posts for the month of July 2009

'su' in Android 1.5

In Android 1.5, the 'su' command can no longer be run from the Terminal Emulator app, even on the Android Dev Phone 1. It can however be run from within an adb shell. I want root access to the device even when it isn't tethered to another computer. Here is a simple way to have a root shell available:

Run Terminal Emulator, and execute the 'id' command. This tells you what user and group this program is running as. In my case, the output is

uid=10025(app_25) gid=10025(app_25) groups=3003(inet)

We will want to grant root access to the app_25 group.

Connect to the phone using adb shell, then execute

$ su
# mount -oremount,rw /dev/block/mtdblock3 /system
# cat /system/bin/sh > /system/xbin/rootsh
# chown root.app_25 /system/xbin/rootsh
# chmod 4750 /system/xbin/rootsh
# mount -oremount,ro /dev/block/mtdblock3 /system

From the Terminal Emulator app you can now run 'rootsh' and have a root shell, but other applications cannot run it which hopefully addresses some of the security concerns.