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
    Commented Oct 20, 2016 at 10:57
  • What group do you see assigned to a random folder on sdcard (such as /mnt/sdcard/foo) in the root explorer? Commented Oct 20, 2016 at 13:06
  • 9997, which doesn't have a corresponding name in the list.
    – Andy Yan
    Commented Oct 20, 2016 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). Commented Oct 20, 2016 at 15:40
  • What does id sdcard_r and id -G sdcard_r returns?
    – Firelord
    Commented Oct 20, 2016 at 21:12

1 Answer 1


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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .