【发布时间】:2014-02-10 11:56:39
【问题描述】:
使用 Android SDK,我可以通过调用 su 以超级用户身份运行进程,然后运行我的代码。我怎样才能在 iOS 上做同样的事情?
这是我在 Android 上使用的:
// Elevate to root
Process localProcess = Runtime.getRuntime().exec( "su");
// Now run some command as root
DataOutputStream localDataOutputStream = new DataOutputStream( localProcess.getOutputStream());
localDataOutputStream.writeBytes( "chmod 666 file.name\n");
localDataOutputStream.writeBytes( "exit\n");
localDataOutputStream.flush();
我尝试了以下 C 命令,但收到一条错误消息,指出我的密码不正确。
system( "ls -l /System/Library/TextInput/TextInput_zh.bundle/Keyboard-zh.plist"); // read start permissions
system( "sudo -s alpine | chmod 666 /System/Library/TextInput/TextInput_zh.bundle/Keyboard-zh.plist"); // trying change permissions
system( "ls -l /System/Library/TextInput/TextInput_zh.bundle/Keyboard-zh.plist"); // read changes
日志如下所示:
-rw-r--r-- 1根轮7813 Dec 16 10:47 /System/Library/TextInput/TextInput_zh.bundle/Keyboard-zh.plist
chmod:更改`/System/Library/TextInput/TextInput_zh.bundle/Keyboard-zh.plist'的权限:不允许操作
我们相信您已经收到了本地系统的常规讲座 行政人员。通常归结为以下三点:
#1) Respect the privacy of others. #2) Think before you type. #3) With great power comes great responsibility.密码:
-rw-r--r-- 1根轮7813 Dec 16 10:47 /System/Library/TextInput/TextInput_zh.bundle/Keyboard-zh.plist
如何在 iOS 上以编程方式运行任何具有 root 权限的脚本?我正在寻找一个适用于越狱设备的答案,但如果可能的话,我会对也适用于库存设备的东西感到满意。
【问题讨论】:
-
越狱:很容易,没有越狱:绝不。
-
@H2CO3 请提供任何越狱示例和问题:在 android 中我需要安装超级用户应用程序才能运行此代码。在 iOS 中我必须先安装任何程序?
-
@Moshe 感谢您编辑我的初学者英语
-
你没有机会走合法的路。 Apple 商店中没有此类应用程序。还有什么,出于安全原因,非常好。为什么查看类别在这么深的层次?
-
我不明白为什么我的问题有很多反对意见!!???这个问题我没有违反任何规则。而且我认为回答“越狱:很容易,没有越狱:绝不”并且不给出示例答案的人是一个大洪水。
标签: ios objective-c permissions sudo su