Search code examples
android-sourceselinux

Cannot change file to executable


I have the following file /data/MyExec/Exec.

I want to execute this file when the android device boots, therefore I created a service in init.rc that runs it.

The problem is that the file doesn't have execute permissions, so I also have to run chmod +x on the file before I execute it.

Because I run this file from init.rc I have to define { execute } in a policy file, and I did.

The problem is that I can't define both { setattr } and { execute } for the same file.

How then can I make it executable and run it on boot?

Thanks!


Solution

  • The solution was to place the exec in /bin/Exec. Files there are automatically executable and there's no need to change their mode.