Open GoogleCodeExporter opened 9 years ago
I'm seeing two potential ways:
1. using "Runtime.getRuntime().exec...", clean way is to use it through this
lib:
https://github.com/Chainfire/libsuperuser/tree/master/libsuperuser/src/eu/chainf
ire/libsuperuser
2. adding in com_googlecode_android_scripting_Exec.cpp
(http://code.google.com/p/android-scripting/source/browse/android/ScriptingLayer
ForAndroid/jni/com_googlecode_android_scripting_Exec.cpp?r=28fd0c99780e713524ff0
8b0a362a56eaf803429) ability to launch process as root (setuid setgid...)
Original comment by anthony....@gmail.com
on 18 Sep 2013 at 5:45
Thank you very much for your reply!! I tried the second solution by changing
the cpp file and recreating the .so but again the same problem. I think I do
not put setuid(0) and setgid(0) in the suitable position. Can you please give
me a clarification? It would help me a lot.
Original comment by georgelo...@gmail.com
on 19 Sep 2013 at 12:49
I would try first of a simple example and printf output, smth like:
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
int main(void)
{
printf("euid=%4d uid=%4d egid=%4d gid=%4d\n", geteuid(), getuid(), getegid(), getgid() );
printf("%i \n",seteuid(0));
perror("seteuid");
printf("%i \n",setegid(0));
perror("setegid");
printf("euid=%4d uid=%4d egid=%4d gid=%4d\n", geteuid(), getuid(), getegid(), getgid() );
return 0;
}
Also some permission change might be needed in
http://code.google.com/p/android-python27/source/browse/apk/src/com/android/pyth
on27/ScriptActivity.java , 6755 instead of 0755 in the line:
FileUtils.chmod(new File(this.getFilesDir().getAbsolutePath()+
"/python/bin/python" ), 0755);
Same in
http://code.google.com/p/android-python27/source/browse/apk/src/com/android/pyth
on27/support/Utils.java
Original comment by anthony....@gmail.com
on 19 Sep 2013 at 1:20
Any updates ? Did you manage to get it working ?
Original comment by anthony....@gmail.com
on 28 Sep 2013 at 7:28
I didn't manage to get it working in this way. I used the project just to
install python27 to android and then I managed to run the script with root
privileges with terminal commands. Thank you!
Original comment by georgelo...@gmail.com
on 1 Oct 2013 at 10:10
Original issue reported on code.google.com by
georgelo...@gmail.com
on 18 Sep 2013 at 5:17