[英]On a jailbroken iPhone, how can I run commands as root?
I want to login as a root using system
call in Xcode. 我想在Xcode中使用system
调用以root身份登录。 I try this code without success: 我试用这段代码没有成功:
System("su");
System("alpine");
or 要么
System("su root");
System("alpine");
or 要么
System("su root alpine");
When I google it I came to know that this is done using NSTask
or NSPipe
. 当我谷歌它时,我开始知道这是使用NSTask
或NSPipe
。 Can anybody tell me how it possible to run multiple system
commands using NSTask
and NSPipe
? 谁能告诉我如何使用NSTask
和NSPipe
运行多个system
命令?
Please give me some hints about this or another method to do this. 请给我一些关于这个或其他方法的提示。 I am using this application on jailbroken iPhone. 我在越狱的iPhone上使用这个应用程序。
If you want to launch something as root you may use sudo
. 如果你想以root身份启动某些东西,你可以使用sudo
。
Example of it's usage in one line with the password: 使用密码在一行中使用它的示例:
echo <password> | sudo -S <command>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.