1

The question says it all. All folders on my sdcard has owner set as 0(root) and group set as sdcard_r - means all apps that have permissions to access the sdcard.

However, since I have root, I want to change the group of this folder using chgrp, so that only a selected app can access this. I know how to do this too, so no probs until now.

However, I don't want this to be a one-way setting, I want to be able to revert back to sdcard_r in case something goes wrong. Now I don't know the actual gid of this group sdcard_r and chgrp only works with gids, not names. So, how can I find the gid of this group, sdcard_r?

  • Weird, I don't even see a sdcard_r group listed in Root Explorer on my devices... – Andy Yan Oct 20 '16 at 10:57
  • What group do you see assigned to a random folder on sdcard (such as /mnt/sdcard/foo) in the root explorer? – Prahlad Yeri Oct 20 '16 at 13:06
  • 9997, which doesn't have a corresponding name in the list. – Andy Yan Oct 20 '16 at 14:11
  • k, and if you open a terminal app and go to the sdcard folder and perform ls -al, what group does it show there? (In my case its sdcard). – Prahlad Yeri Oct 20 '16 at 15:40
  • What does id sdcard_r and id -G sdcard_r returns? – Firelord Oct 20 '16 at 21:12
2

Use the following command to see GID of the concerned group:

id -G group_name

Courtesy of this answer of doylefermi.

It is very much possible that the GID would be 1028 given this line in source code of Android.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.