1

How do I identify the number (integer value) of a particular group associated with a file?

ls -l
drwxr-x--x root     system              2014-11-26 10:59 xyz

I have managed to check that group id of root is 0. What is the corresponding number of group id for system?

I need to change the group of my file to system. How do I do it using chown? gid_t is internally of int type. So what value should I pass to make it system? How do I know?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Sandeep
  • 18,356
  • 16
  • 68
  • 108

4 Answers4

1

Check with AID_XXX Ex: AID_SYSTEM in the source code. The corresponding value is the integer value of it.

AID_SYSTEM is 1000

Similarly it can be found for other groups as well.

I don't know if there is a better way.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Sandeep
  • 18,356
  • 16
  • 68
  • 108
1

At adb shell

su 1000

since 1000 is the system uid

id

This returns

uid=1000(system) gid=1000(system)

So gid for system is 1000 too

nandeesh
  • 24,740
  • 6
  • 69
  • 79
1

Since you're talking about files specifically, the easiest way is just ls -n:

$ ls -ld /data
drwxrwx--x system   system            2015-06-04 11:59 data
$ ls -ldn /data
drwxrwx--x 1000     1000              2015-06-04 11:59 data
frogatto
  • 28,539
  • 11
  • 83
  • 129
domen
  • 1,819
  • 12
  • 19
0
chgrp 1000 /path/filename

1000 is the system group id, and also the system user id

chgrp is included in busybox.

frogatto
  • 28,539
  • 11
  • 83
  • 129
Rickey
  • 1
  • 2