views:

52

answers:

2

Hi There.

As the topic describes, my app is in /Applications folder and it has got root access but still i cant write/Edit a file in /System/Library/CoreServices.

Can anyone advice me on how to do this?

P.S. I m developing for Jailbroken iOS4 (iOS 4 SDK).

A: 

Have you checked the flags for that directory? Maybe it's set as "system immutable". Take a look at the chflags command to learn more about file's flags.

Macmade
You mean my apps flag?? or the /System/Library/CoreService/Someplist.plist files flag??
raziiq
No, I mean the flags of the directory you want to write in.
Macmade
thanks for guiding, and can you please explain how to check those flags, i mean what flags can prevent writing to that directory?
raziiq
@raziiq, looks useful: http://www.unix.com/man-page/OSX/1/chflags/
sarnold
The simmutable flag can prevent root to write. You can check with 'ls -lO'
Macmade
thank you guys. I just checked chflags command in my iPhone and it says, command not found :O , why is that??
raziiq
+1  A: 

Alright, got this working, you got to have root access with admin as group and SetUID flag should be set to write to that specific location. What i did is, i saw the directory structure of Cydia.app and compiled my app according to that(e.g. Cydia and Cydia_).

Rename your app name to YourApp_ and make a new file named YourApp and post the text below into it, set the proper permissions and you are good to go.

#!/bin/bash
C=/${0}
C=${C%/*}
declare -a flags
exec "${C:-.}"/MyApp_"${flags[@]}" -- "$@" 2>>/tmp/MyApp.log`

BTW YourApp binary should have a permission of 4755 to setuid flag as well.

raziiq