16

How can I get root permissions in a terminal?

15

Type su and your terminal prompt should change from $ to #. This is assuming that your device is already rooted.

| improve this answer | |
  • 2
    AND that su is installed. – Matthew Read Dec 24 '10 at 22:56
  • i try it but this message shown "permission denide" – mahdi Dec 25 '10 at 11:03
  • @mahdi: Is your device already rooted? – Lie Ryan Dec 25 '10 at 11:51
  • no i try it on emulator – mahdi Dec 25 '10 at 19:31
  • 1
    @HXCaine: If you don't have permission to run su, you probably don't have permission to chmod it. – Keith Thompson Apr 6 '13 at 21:41
3

See the following questions:

  • 1
    But how does this address the question? – Firelord Nov 14 '18 at 10:50
1

Production phones don't ship with root access, developer phones do. If you have a production phone (likely: you'd know if you bought a dev phone), you have to "root" them first. As @Joe_Casadonte points out, there are some great instructions here and elsewhere (Notably the CyanogenMod Wiki and Android Rom's google group) to get you started rooting your phone. (And if you get stuck ... come back here with your questions!).

Once you've rooted your phone, you can gain root privileges in the adb shell or the terminal emulator with the su command.

Note: it sounds from some of your responses like you haven't yet rooted your phone. So you'll need to start there.

| improve this answer | |
0

Assuming that:

  1. Your Android device is rooted;
  2. The su binary is located at /system/xbin/su;
  3. The shell binary is located at /system/bin/sh; and
  4. Your Android device has Terminal Emulator installed.

If all the 4 conditions above are satisfied, then:

  • If you want to enter the shell and become root (superuser uid 0) so you can execute commands without uid restrictions, start the Terminal Emulator app and just execute this command:

    su -
    

    In order to disconnect from the uid 0 (exit superuser status), press Volume - and D, or type exit and hit Enter

  • Alternatively, if you want to always start Terminal Emulator as root, then start Terminal Emulator, go to Preferences, scroll down to the SHELL section, tap the Command line option and modify the command so it becomes this:

    /system/xbin/su -c "/system/bin/sh -"
    

    After you change the command, exit Terminal Emulator (close the application) and start it again. Notice how Terminal Emulator's shell interface now shows you root@something by default.

| improve this answer | |
0

For my 8.1.0 go edition phone. It is /sbin/su -c "/system/bin/sh -". I struggle too much to figure out where is su binary file(in my case su binary not exist in the /system/xbin/ path). I found a path /sbin/ is exist in ROOT directory and su binary is exist in that path. And of course i rooted my phone by magisk manager. Hope this answer will help someone.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.