0

I have cross-compiled a binary on Linux using the arm toochain. I uploaded the binary to a non-rooted andnroid phone.

What do I need to do in order to run this binary on the non-rooted phone ?

EDIT: I tried to run via terminal emulator, but I get the following error.

$ pwd
/mnt/sdcard/external_sd
$ ls -l hello
-rwxrwxr-x system   sdcard_rw     8420 2013-12-31 22:12 hello
$ ./hello
./hello: permission denied
$
  • I suppose you could install a terminal emulator, navigate to the binary, and use ./binary to invoke it. Making sure permissions are properly set, of course. – dotVezz Dec 31 '13 at 18:56
  • I tried this, but the file is not executable on sdcard, i tried chmod +x, but it does nothing. I tried to copy binary to /data folder on phone, but got permission error. How can i run it ? – aseaudi Dec 31 '13 at 19:14
  • Can you edit your question and give us the output of ls -l [file]? You won't be able to move anything to /data/ because it's owned by root. – dotVezz Dec 31 '13 at 19:23
  • check my edit above – aseaudi Dec 31 '13 at 20:19
  • 2
    sdcard is probably (usually) FAT32/exFat, so it doesn't have Linux permission system, which is why you can't execute or chmod anything on it. I would try to find a "rw" partition using mount (e.g. /cache) and trying to execute from there. – Chahk Dec 31 '13 at 20:38
1

Removable media, as well as several other (user writable) partitions are mounted NOEXEC, meaning you can't execute binaries on these partitiions. See the output of 'mount' for details. Modern android builds generally prevent you from copying binaries to partitions mounted EXEC as a security precaution.

Short of rooting your device, you can't run this binary.

  • This one's correct. – iBug Feb 28 '17 at 3:24
1

You can download termux, copy your binary to the termux home folder and run it

cp /storage/emulated/0/mybinary .
chmod +x mybinary
./mybinary

I haven't actually managed to run something because I don't have an android binary handy and a quick google doesn't bring up any android hello world binaries, but it should work.

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.