How to get the root permission of an application on an iOS device

Source: Internet
Author: User

To create a small tool software requires root permissions. After countless attempts by Google, this problem is finally solved.

The idea has been mentioned in many articles. First, install the application to the/applications directory. I package it into Deb and install it through cydia;

Second, the springboard will not grant the root permission to the application when starting the application. If the user group of the executable file is root: wheel and the setuid bit is set, the application will not be executed, the specific manifestation is that the application exits after a flash. to bypass this problem, another executable file without setuid is required to serve as a bridge, this executable file is disguised as an application executable file. It is used to start a real application executable file.

The main steps are as follows:

1. After the device is jailbroken, ensure that appsync is installed.

2. Assume that the Application name is losttemp. Add setuid (0) and setgid (0) before the main function of the target application code. The two lines of code are compiled by xcode, bind the application bundle (losttemp. copy the file and change the name of the executable file, such as losttemp_root.

3. Compile another executable file (I directly modify the main function of the above application). The main function is similar to the following format. After compilation, change the executable file name to losttemp and copy it to the losttemp file described above. APP:

Nsstring * string = [[nsbundlemainbundle]
Pathforresource: @ "losttemp_root" oftype: Nil];

Argv [0] = (char *) [stringutf8string];

Execve ([stringutf8string], argv,
Null );

4. Change the losttemp permission of the executable losttemp file of losttemp to 755 (chmod), and change the losttemp_root permission to 4755.

5. Package losttemp. app as Deb and set the target installation directory to/Application

6. Put Deb in the/var/root/Media/cydia/autoinstall directory of the device. Restart the device and it should be OK.

Refer to the following articles:

Http://o0o0o0o.iteye.com/blog/983311

Http://wangxinglong.blog.51cto.com/679714/340161

Http://blog.sina.com.cn/s/blog_7879b14f01016q8n.html

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.