Reputation: 772
I'm trying to run some hacky prototype code on a rooted WearOS device. I don't need to scale this to multiple devices or into a production enivronment.
At one point in my app I try to invoke su
:
val su = Runtime.getRuntime().exec("su")
val outputStream = DataOutputStream(su.outputStream)
Which lead to an error:
Caused by: java.io.IOException: Cannot run program "su": error=13, Permission denied
I thought I might be clever and just chmod /system/xbin/su to be world executable. I am aware this is a terrible idea for security reasons but again this is just so I can do something at my desk and then reformat the device. It seemed to work:
adb shell ls -l /system/xbin/su
-rwxrwxrwx 1 root shell 5788 2009-01-01 11:00 /system/xbin/su
But I still get the permission denied error when I try to run my app. What am I missing? I'd be up for a proper fix (I expected the app would ask for a superuser permission on launch - it doesn't) or a similarly stupid low-level OS solution.
Upvotes: 1
Views: 204