1

Where do I enter the commands for SU abilities and root access or settings?

fd = open("/system/file.txt", O_RDWR | O_LARGEFILE | O_NONBLOCK); if (fd < 0) { return -8002; } 

Code source: Can android user become a super user in android?

No, I'm not doing this for any reason, and I don't need to throw an explanation at all. I'm just tooling around and I'm trying to learn on my own as well as reading and doing my own research, so please spare me the whys, the whats, and the whos, and just explain to me where I enter these commands.

1
  • 5
    Note that the code you have quoted from the other question is C code (wich needs to be compiled and is part of a larger program). And it has nothing to do with becoming or using root permissions, it is simply a command that opens a file on the system partition in read/write mode. IMHO instead of quoting other questions you should describe what you are trying to do and what you have already tried. Commented Jun 30, 2024 at 14:46

1 Answer 1

2

If you have an Android device that is rooted with ADB enabled, you can access the root environment like this:

adb shell su root whoami

This should respond:

root

The breakdown of this command is:

  1. adb Run the ADB program on your computer. For this example, it doesn't matter what OS your computer is running provided you have the appropriate adb program available via PATH.
  2. shell Run the "shell", the command-line interpreter, on the device.
  3. su Run the su program on the device. This can run programs under any account.
  4. root Tell su that you want to use the root account and, by implication, its privileges.
  5. whoami Tell su to run the whoami program, which just prints the name of the account that has run it. You can use other programs in place of whoami, it was just a convenient example for this answer.

If none of this answer meant much to you, you need to learn about using computers from their command lines. That idea is not Android-specific, and it's easier to learn it on a Windows, Linux or macOS machine. All of these have somewhat different command line systems, but the basic idea is the same on all of them. The Android command line system is a variant on the Linux one.

The "commands" you give in the question are a fragment of a C program. To run them in the root environment, you need to compile the complete program into an executable, copy it onto the device with adb push and then invoke it via su root my-executable.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.