Magic Root Access

From Android Wiki

(Difference between revisions)
Jump to: navigation, searcha
m (fhtagn)
Line 1: Line 1:
-
==Accessing Root from the Magic/Sapphire Terminal Emulator==
+
fhtagn
-
Now that you have followed [[Magic Rooting]] to root your HTC Magic/Sapphire, you will notice that it is not possible to gain a root from an application running on the phone.  The only way to get root access is through the ADB shell.  In order to be able to gain root access using '''su''' with a [http://www.cyrket.com/search?q=Terminal+Emulator Terminal Emulator application] the '''su''' utility in '''/system/xbin/su''' needs to be replaced.  In Android 1.5, the '''su''' utility was updated to allow only the '''shell''' and '''root''' users to gain root access[http://magicandroidapps.com/].  Since the '''adb shell''' runs as the shell user, the '''su''' utility will give root access through the '''adb shell.'''  These instructions will also work for G1/ADP1 users who have upgraded to Android 1.5 and rooted their phone.
+
-
 
+
-
'''*** NOTE: Installing the modified '''su''' utility opens up a security risk to your phone, since any App can gain root access.  You have been warned... ***'''
+
-
 
+
-
* First, download the [http://www.magicandroidapps.com/su.zip modified '''su''' utility (ZIP)], and unzip it somewhere on your computer.  The instructions below assume '''C:\Android'''.
+
-
 
+
-
* Make sure you have ADB installed on your PC, and that USB Debugging is enabled on your phone.  For details, [http://androidcommunity.com/forums/f4/how-to-install-apps-using-adb-4482/ see this post].
+
-
 
+
-
* Next, open a '''DOS Command Prompt''' window, and push a modified '''su''' utility to your phone.  This utility will then be copied into the proper location to replace the existing '''su''' utility.
+
-
<pre>
+
-
C:\Android>adb push su /data/local
+
-
595 KB/s (76200 bytes in 0.125s)
+
-
</pre>
+
-
* Next, use '''adb''' to get a shell prompt on your phone:
+
-
<pre>C:\Android>adb shell</pre>
+
-
* Gain '''root''' access using the existing su utility:
+
-
<pre>
+
-
$ su
+
-
#
+
-
</pre>
+
-
* Then, remount the '''/system''' partition as read/write so you can replace the existing '''su''':
+
-
<pre>
+
-
# mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
+
-
</pre>
+
-
* The '''su''' utility is located in '''/system/xbin'''.  The following commands will back up your existing '''su''' utility as '''osu''', and install the modified '''su''' utility, and change the permissions appropriately.
+
-
<pre>
+
-
# cd /system/xbin
+
-
# mv su osu
+
-
# cat /data/local/su > su
+
-
# chmod 6755 su
+
-
</pre>
+
-
* Now, check your work, and make sure the permissions on the new '''su''' match those of the original '''osu'''.
+
-
<pre>
+
-
# ls -l *su
+
-
-rwsr-sr-x root    root        76200 2008-08-01 05:00 osu
+
-
-rwsr-sr-x root    root        76200 2009-05-30 11:28 su
+
-
</pre>
+
-
* Finally, if everything checks out, sync the filesystem, and reboot your phone:
+
-
<pre>
+
-
# sync
+
-
# reboot
+
-
</pre>
+
-
* After your phone reboots, you will be able to '''su''' to root from the [http://www.cyrket.com/search?q=Terminal+Emulator Terminal Emulator application].
+

Revision as of 21:25, 1 August 2009

fhtagn

Personal tools