permission denied: How to do su or setuid? shareUid = android.uid.shell in manifest or commenting su.c's uid check didn't help.

705 views
Skip to first unread message

Adithya Gajulapally

unread,
Jun 5, 2014, 11:20:21 AM6/5/14
to android-...@googlegroups.com
We have low-level binaries that are pushed to /data and run from adb root for purely R&D purposes. I am trying to put these commands in an app for KitKat (we only did kitkat bring up). I tried commenting out the following code snippet from /system/extras/su.c

    if (myuid != AID_ROOT && myuid != AID_SHELL) {

        fprintf(stderr,"su: uid %d not allowed to su\n", myuid);

        return 1;

    }

That didn't work. So, I tried using shareUid = "android.uid.shell" in manifest and signed the apk with platform key and cert. Both the hacks just returns "permission denied" in STDERR.

Someone in my organization told me that setuid is no longer working. So, how do I get any apk to to su or atleast ones that signed with platform keys.

Adithya Gajulapally

unread,
Jun 12, 2014, 1:36:30 PM6/12/14
to android-...@googlegroups.com
I couldn't find a way to let java processes call su. So, I had to create a native daemon that receives shell commands on a socket and executes them with root privileges. I added it to init.rc to start at boot. I then used AsyncTask to send the shell commands to this socket. I couldn't find a way to do it directly from the App. Let me know if anyone found a way for apps to run with root privileges.
Reply all
Reply to author
Forward
0 new messages