Reputation: 49
I want to login as a root using system
call in Xcode. 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
.
Can anybody tell me how it possible to run multiple system
commands using NSTask
and NSPipe
?
Please give me some hints about this or another method to do this. I am using this application on jailbroken iPhone.
Some more details are here.
Upvotes: 4
Views: 7643
Reputation: 4424
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>
Upvotes: 1