3

I would like to make an app that will manage some files on jailbroken devices like SMS, Notes .db, but I have problems with accessing such files. I've also made just to test my skills, similar application like your file manager and I could browse almost whole file system and access everything except some folders in /var/mobile/Library/. I get a list of contents of /var/mobile/Library but I get nothing in subdirectories like /var/mobile/Library/Notes/, /var/mobile/Library/SBSettings/, and btw what is most important in my case: /var/mobile/Library/SMS/ or /Notes/ displays nothing. Of course when I browse my device by SSH using Fugu I got everything and have access to everything (like chmod i.e.)

I would be great if you please give me some advices or source code what should I do to have, I guess the root's privileges, not only to access those files, but also change their permissions and names. I know how to make such operations using typically NSFileManager, but not on files from the directories above like /.../SMS/.

I've never developed an application that strictly need jailbroken device to perform the given tasks. I believe I will need some extra libraries? Is it true? Can I use Xcode or there is something else to develop such apps.

I would be very grateful!

roalz
  • 2,699
  • 3
  • 25
  • 42
  • hello kris. i am also trying to access the /private/var/mobile/Library/SMS/sms.db. but when i provide this path to sqlite3_open, it always gives the error "unable to open database file" but when i access /private/var/wireless/Library/CallHistory/call_history.db, the database opens perfectly. Can u please tell me how did u solve this problem? what did u use to access sms.db? it would be a great help. thnx – Jayshree Apr 01 '11 at 13:39

1 Answers1

2

Even when jailbroken, applications installed via Xcode or the App Store are still sandboxed. To get read-only access to the entire filesystem, an application has to be installed in /Applications/ instead of /var/mobile/Applications/. To get write access to the entire filesystem, the application would additionally have to be owned by root and be flagged with the setuid mode

rpetrich
  • 32,196
  • 6
  • 66
  • 89
  • Yes, but I'm not ging to distribute it in App Store but in Cydia only. So what do I have to do to make my App be owned by root and in setuid mode? –  Oct 08 '09 at 21:42
  • 1
    Upload your application to /Applications/ and then "chmod 6777 /Applications/YourApp.app/YourApp" and "chown root:admin /Applications/YourApp.app/YourApp" from SSH. Note: very few applications require root; bugs in your application could cause the device to be unbootable without a restore – rpetrich Oct 10 '09 at 07:12
  • Sorry to resurrect this old question, but I've asked a similar one here: http://stackoverflow.com/questions/7464332/deploying-ios-apps-to-applications-from-xcode-via-build-phase-script-jailbroke with a +100 bounty. Is there a way to make XCode automatically deploy to /Applications? I need gdb for testing. Thanks for all your help – Daddy Sep 28 '11 at 12:42
  • Using iOS 5. setuid root is not authorized anymore, even on JB phones. – Sébastien Stormacq Aug 26 '12 at 22:15
  • Let me rephrase : an application with setuid root will not be launched as root by SpringBoard (SB runs as mobile). The only way I found to launch an application as root from SpringBoard is to replace the app with a shell script which, in turn, launch the real app. Booth are setuid root (chmod 6755) AND the app call setuid(0);setgid(0); from the code. If you have an easier solution - I am willing to hear from you :-) - Thanks – Sébastien Stormacq Sep 01 '12 at 20:44
  • Yes, an intermediary mobile-owned binary is required on modern iOS versions (3.2+ perhaps?) – rpetrich Sep 04 '12 at 01:21