shell - Android root commands not working in application -


i experimenting shell commands on rooted nexus 7 tablet , found commands seem wouldn't need root privilege being executed.

for example, if call:

  process process = runtime.getruntime().exec("su -c mkdir /sdcard/test"); 

the directory created. if call:

  process process = runtime.getruntime().exec("su -c mkdir /system/test"); 

nothing happens.

(i have tried sorts of commands, , tried sorts of different syntax in case off, commands wouldn't need root access executed)

when try execute command, popup superuser , grant application root privilege there else missing? have looked around , far can tell should work.

thanks.

  1. you must quote argument mkdir, otherwise su assume /system/test user name , fail run.

    process process = runtime.getruntime().exec("su -c \"mkdir /path/to/test\"");

  2. some areas of filesystem, such /system, read due way filesystem organized/mounted. root access won't change that, command still fail.

to verify whether you're trying possible, install terminal emulator on device , run command hand first.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -