Wednesday, October 19, 2011

Adding User or Group to Android

Today I had a requirement to add a group(GID) to android system.

I found out that android system has hardcoded GID's for few Groups which is defined during the build time.

Step1: vim $(Android_root_folder)/system/core/include/private/android_filesystem_config.h

Add the below line for "lp" group creation

eg: #define AID_LP 3006

static struct android_id_info android_ids[]={
{"lp", AID_LP, },
};

Step2: Build the android source code.

Step3: Test whether group is created on some file eg: chown root.lp <file_name>

Step4: ls -l on the files you chowned, you can see group gets added successfully.


Note: Like linux you cant find /etc/passwd or /etc/group files in case of android. All the group additions are hardcoded.

I am yet to figure out how we can add users to the groups.