I am trying to give access to a file I have written in one app to another app.
chgrp
is not available in the adb shell (command 'chgrp' not found
)
I have installed BusyBox but in order to get access to chgrp
.
For example I use the command chown app_79 file.txt
and it works.
But when I try chgrp app_79 file.txt
it always returns something like chgrp: unknown group app_79
I Googled a bunch and found that most linux systems have a file /etc/group
which stores the group information for that system, but it is not present in Android.
Using the builtin tools, rather than busybox, it would be
chown uid.gid filename
Probably with these id's having to be numeric as Matt pointed out.
Use busybox chown uid.gid file.txt
and specify UID and GID as numbers instead of names. app_79
likely corresponds to ID 10079 (to be sure you may recheck it with busybox ls -l -n /data/data
):
busybox chown 10079.10079 file.txt
Found some information here about how some group ids are hardcoded. I also had previous knowledge that /data/system/packages.list
and /data/system/packages.xml
contained the UIDs of apps, which are all something like 10000+x. What I now know is that x is the number that comes after "app_" when you ls -l.
So, the weird thing is you can chgrp 10079 file.txt
but you cannot chgrp app_79 file.txt
.
Hope this helps someone.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With