-1

I searched some related questions in this forum. The most relevant Question is

How to run subprograms with root permissions on iOS?

I realized, that there is a function on Android also with

Runtime.getRuntime().exec( "su");

and now I want to realize the same function on iOS. In the process of realization. I need to get the root privilege. bucause some commands should run with root privilege.

I use the following method

system("ping 127.0.0.1");

All is ok. But when I change the route table with

system("route add -host 192.168.1.10 192.168.1.11");

I get the error. Because adding route item to the route table needs root privilege. I tried the following command

echo alpine | sudo -s route add -host 192.168.1.10 192.168.1.11

but there is no sudo command.

Thanks in advance for any useful pointers/suggestions/thoughts.

Community
  • 1
  • 1
qhyuan
  • 1
  • 2
  • 1
    I really doubt that you can reach root privilege in iOS without jailbreaking your device. – Nicolas Buquet May 21 '15 at 10:31
  • @NicolasBuquet I have jailbreaked my ios device.I tried the application named ios terminal. that is a napplication which looks like cmd or terminal in windows/linux. using the default account and pwd can get root privilege – qhyuan May 22 '15 at 01:55

1 Answers1

1

You can't get root privileges on iOS. (EDIT: Unless you are on a jailbroken device, I guess)

But you cant take a look at this class, that achieves ICMP pings. I'm not sure about the route though.

Quentin Hayot
  • 7,786
  • 6
  • 45
  • 62
  • Thanks a lot. I will see the code you gave me. there are some similar apps in the app store.But I tried the application named ios terminal. that is a napplication which looks like cmd or terminal in windows/linux. using the default account and pwd can get root privilege.so there is a way to get root privilege – qhyuan May 22 '15 at 01:50
  • I think this is a fake/emulated root access. iOS will NEVER let you out of your app sandbox (excepted for public APIs that allow access to shared data (keychain, inter-app audio...)... unless you are working on jailbroken devices. – Quentin Hayot May 22 '15 at 08:08
  • you are right. i want to get root privilege on a jailbroken ipad. now this is my problem that how to execute the command with root privilege on jailbroken ios devices using system("***") function – qhyuan May 22 '15 at 14:39
  • Then you should specify it in your question, maybe you'll get answers from jailbroken apps developers. – Quentin Hayot May 22 '15 at 14:42
  • thanks for your warning. i will edit my question immediately. – qhyuan May 22 '15 at 15:00