在越狱的 iPhone 上,如何以 root 身份运行命令? [英] On a jailbroken iPhone, how can I run commands as root?

查看:67
本文介绍了在越狱的 iPhone 上,如何以 root 身份运行命令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在 Xcode 中使用 system 调用以 root 身份登录.我尝试此代码但没有成功:

I want to login as a root using system call in Xcode. I try this code without success:

System("su");
System("alpine");

System("su root");
System("alpine");

System("su root alpine");

当我谷歌它时,我知道这是使用 NSTaskNSPipe 完成的.谁能告诉我如何使用 NSTaskNSPipe 运行多个 system 命令?

When I google it I came to know that this is done using NSTask or NSPipe. Can anybody tell me how it possible to run multiple system commands using NSTask and NSPipe?

请给我一些有关此方法或其他方法的提示.我在越狱的 iPhone 上使用这个应用程序.

Please give me some hints about this or another method to do this. I am using this application on jailbroken iPhone.

更多详细信息位于此处.

推荐答案

如果你想以 root 身份启动某些东西,你可以使用 sudo.

If you want to launch something as root you may use sudo.

它与密码在一行中的用法示例:

Example of it's usage in one line with the password:

echo <password> | sudo -S <command>

这篇关于在越狱的 iPhone 上,如何以 root 身份运行命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆