System.err: java.io.IOException: Cannot run program "su": error=13, Permission denied
1: android/system/core/libcutils/fs_config.cpp
改為
{ 04755, AID_ROOT, AID_SHELL, 0, "system/xbin/su" },
2: android selinux
(1)透過adb:
adb connect 192.168.1.13
adb root
adb shell setenforce 0
adb shell getenforce
(2)透過console:
setenforce 0
getenforce
(3)source code:
https://source.android.com/security/selinux/implement
由上面網址中, 可以看出設定
BOARD_KERNEL_CMDLINE := androidboot.selinux=permissive
但是我在kernel找不到BOARD_KERNEL_CMDLINE?
system/core/init/Android.mk
-DALLOW_PERMISSIVE_SELINUX=1
import java.io.*;
Runtime runtime = Runtime.getRuntime();
try {
Process localProcess = runtime.exec("su");
OutputStream localOutputStream = localProcess.getOutputStream();
DataOutputStream localDataOutputStream = new DataOutputStream(localOutputStream);
localDataOutputStream.writeBytes("/vendor/bin/hostapd_cli status");
localDataOutputStream.flush();
} catch (IOException e) {
e.printStackTrace();
}
沒有留言:
張貼留言