取得Android root权限(Magic Root Access)

Accessing Root from the Magic/Sapphire Terminal Emulator

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 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 rootusers to gain root access[1]. 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 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, 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.
C:/Android>adb push su /data/local
595 KB/s (76200 bytes in 0.125s)
  • Next, use adb to get a shell prompt on your phone:
C:/Android>adb shell
  • Gain root access using the existing su utility:
$ su
#
  • Then, remount the /system partition as read/write so you can replace the existing su:
# mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
  • 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.
# cd /system/xbin
# mv su osu
# cat /data/local/su > su
# chmod 6755 su
  • Now, check your work, and make sure the permissions on the new su match those of the original osu.
# 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
  • Finally, if everything checks out, sync the filesystem, and reboot your phone:
# sync
# reboot

原文:http://android-dls.com/wiki/index.php?title=Magic_Root_Access

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值